hi all,

I have a form on page1 that submits to page2. The form contains 2 fields which are name and address.

Page2 allows users to go back to page1 or go to page3, so i'm using a function that reads the http_post_var to print hidden values in the page. Here's the code:

function displayValue($HTTP_POST_VARS)
{
if ($HTTP_POST_VARS)
{
while (list($lvar, $lvalue) = each($HTTP_POST_VARS))
{
if($lvar=="name")
{
$lvalue = stripslashes($lvalue);
echo "<INPUT TYPE=HIDDEN NAME=\"$lvar\" VALUE=\"$lvalue\">\n";
}
else
{
echo "<INPUT TYPE=HIDDEN NAME=\"$lvar\" VALUE=\"$lvalue\">\n";
}
}
}
}

When users click to go back to page1, i post the data back to page1.

On page1, i called the function as follows:


<form name="form1" method=post action="form2.php">
<?displayValue($HTTP_POST_VARS);?>
<table width="470" border="0" cellspacing="0" cellpadding="0" valign="top">
<tr>
<td align=right>Introduction:</td>
<td colspan="3">
<input type="text" name="name" maxlength="120" size="40" style="width:300px" value="<?=$name?>">
</td>

</tr>

The problem is that when name is echo in the field value, for example it's like o'\neal , when i view the source code the value of the hidden type is just o 'neal.

Shdn't the value be read from the hidden type?

or shd i use : $name=stripslashes($HTTP_POST_VARS['name']);

thank you

    Write a Reply...