Hi all,
I have one requirement where I have one form in Index.html and I want to display the data for the form on the next page i.e test.html. Here my requirement is to use PHP and not Javascript. Could anyone suggest to me how to do this?
Thanks
You can use php in html forms by <?php echo $_POST[‘value’] ?> for example. Be carefull with $_POST and database connections tho, it is not a safe practice to just post them there.
So for example you have:
<form action=”action.php” method=”post”> <p>Your name: <input type=”text” name=”name” /></p> <p>Your age: <input type=”text” name=”age” /></p> <p><input type=”submit” /></p> </form>
On action.php you can do something like:
Hi <?php echo htmlspecialchars($_POST[‘name’]); ?>.
You are <?php echo (int)$_POST[‘age’]; ?> years old.
Thanks for replying but I am not able to run the PHP on XAMPP server. I see my code displayed in browser. Is there any steps am I missing?
This belongs in r/PHPhelp. See Rule #4.