boorama Posted August 16, 2007 Share Posted August 16, 2007 Hi all, Can any one help me in using hidden values with a form that posts to it self the form has 2 fields one of them is selection from options I want the values of the fields to be there once the form is posted to it self. I have tried to use the following with the form, but it didn't work. <?php $name; $value; while (list($name, $value) = each($HTTP_POST_VARS)) { echo "<input type=\"hidden\" value=\"$value\" name=\"$name\">\n"; } ?> here is the complete code for the form, please help <form action= '<?php echo($PHP_SELF); ?>' method='POST' name='bf'> <p> </p> <table width='50%' border='0' align='center'cellpadding='4' cellspacing='0'> <tr> <td width='29%'><font face='Copperplate Gothic Light'>NHS Number</font></td> <td width='68%'><input name='nhs' type='text' id='nhs'></td> </tr> <tr> <td><font face='Copperplate Gothic Light'>Select hospital</font></td> <td><select name='hosp'> <option></option> <option value='Hammersmith Hospital'>Hammersmith Hospital</option> <option value='Charing Cross Hospital'>Charing Cross Hospital</option> <option value='Selly Oak Hospital'>Selly Oak Hospital</option> </select></td> </tr> <tr> <td><font face='Copperplate Gothic Light'>find appointment</font></td> <td><input type='submit' name="fapp" value='GO'></td> </tr> </table> <?php $name; $value; while (list($name, $value) = each($HTTP_POST_VARS)) { echo "<input type=\"hidden\" value=\"$value\" name=\"$name\">\n"; } ?> </form> Quote Link to comment https://forums.phpfreaks.com/topic/65242-help-with-hidden-values/ 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.