How can i pass values from two html pages to php? -


i have 2 html pages :

page1.html

<html>  <body>  <form action="page2.html" method="post">  enter first name: <input type="text" id="text1">  <input type="submit" value="next">  </form>  </body>  </html> 

page2.html

 <html>  <body>  <form action="test.php" method="post">  enter last name: <input type="text" id="text2">  <input type="submit" value="submit">  </form>  </body> </html> 

now, retrieve value of text1 page1.html , text2 page2.html. how can go it?

looks looking forms. see tutorial http://www.w3schools.com/php/php_forms.asp. post form data page1.php page2.php. on page2.html can access them via $_post.

please aware: not secure example, showing purposes! when want show user generated data in frontend, please use sanitizing , validation http://www.php.net/manual/en/filter.examples.sanitization.php.

page1.php:

<form action="page2.php" method="post">     enter first name: <input type="text" name="firstname"><br>     <input type="submit"> </form> 

page2.php

<h1>hey <?php echo $_post['firstname']; ?></h1>     <form action="lastpage.php" method="post">     enter last name: <input type="text" name="lastname"><br>     <input type="hidden" name="firstname" value="<?php echo $_post['firstname']; ?>">     <input type="submit"> </form> 

lastpage.php

<h1>yo, mate <?php echo $_post['firstname']; ?> <?php echo $_post['lastname']; ?>!</h1> 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -