riavh Posted November 15, 2011 Share Posted November 15, 2011 I am having trouble sending information that was entered into a form, on the same page to the next page. I am sure i have done this a few years ago but cant find the code and cant find the answer online, hope someone can help me. My code is as follows: <form method="POST" action="https://.............. .asp "> <table> <tr> <td>Name: </td> <td><input type="text" name="clientname" /></td> </tr> <tr> <td>E-mail:</td> <td><input type="text" name="email" /></td> </tr> <tr> <td>Contact No:</td> <td><input type="text" name="telno" /></td> </tr> </table> <?php $udate = date("y-m-d H:i:s", strtotime ("+2 hour")); $uniquevalue = "$udate" . " " . "Simpay Pro"; echo $uniquevalue; ?> <br /> <input type="hidden" name="info1" value="<?php print $uniquevalue?>"> <input type="hidden" name="info2" value=$clientname> <input type="submit" value="Submit"> </form> So basically info1 is working i can see the value on the next page after its submitted, but info2 is the value of the input field. Is this possible to do it like this, or do i have to send it to another page and then to my last page that displays the values? Quote Link to comment https://forums.phpfreaks.com/topic/251190-posting-values-from-an-input-field/ Share on other sites More sharing options...
jotorres1 Posted November 15, 2011 Share Posted November 15, 2011 I think you need to add php echo. <input type="hidden" name="info2" value="<?php echo $clientname;?>"> Quote Link to comment https://forums.phpfreaks.com/topic/251190-posting-values-from-an-input-field/#findComment-1288334 Share on other sites More sharing options...
Pikachu2000 Posted November 15, 2011 Share Posted November 15, 2011 The values won't automatically end up in variables with the names of the form fields (at least they shouldn't on a well configured server), they'll be in the $_POST array after the form has been submitted. Quote Link to comment https://forums.phpfreaks.com/topic/251190-posting-values-from-an-input-field/#findComment-1288338 Share on other sites More sharing options...
riavh Posted November 15, 2011 Author Share Posted November 15, 2011 Thank you for the replies the only way i found of passing a value to another field on the same form on the same page is by using javascript Quote Link to comment https://forums.phpfreaks.com/topic/251190-posting-values-from-an-input-field/#findComment-1288441 Share on other sites More sharing options...
jotorres1 Posted November 15, 2011 Share Posted November 15, 2011 I'm glad you got it to work. Note though, that you did mention you wanted the value onto the next page. I am having trouble sending information that was entered into a form, on the same page to the next page. Quote Link to comment https://forums.phpfreaks.com/topic/251190-posting-values-from-an-input-field/#findComment-1288451 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.