Jump to content

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/65242-help-with-hidden-values/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.