Forum Moderators: coopster
My syntax looks like this:
$_POST['$_SESSION['item'][$index]']
But it seem to be calling a null value every time.
Is there some simple syntax I am missing?
Thank you!
On my page, I have a text field with the name set to the value of $_SESSION['item'][12]
Earlier in the script, $_SESSION['item'][12] was set to "KBK4884"
When I type "123" into the text field and submit the form, the syntax
echo $_POST['KBK4884'];
will return the value "123" but
echo $_POST[$_SESSION['item'][12]];
returns no value.
I'm stumped :/
<?php
session_start();
$_SESSION['item'] = array();
$_SESSION['item'][1] = "test2";
echo "Found: " . $_POST[$_SESSION['item'][1]] . "<br>\n";
echo $_SESSION['item'][1] . "<br>";
?>
<form method="POST" action="<?php $_SELF?>">
<input type="text" name="<?php $_SESSION['item'][1]?>">
<input type="submit" value="submit">
</form>
Here is what I see after submitting "123" into the form www21.brinkster.com/dousto/test2.bmp
If you do a view source on your page, do you get:
<input type="text" name="test2">
Or
<input type="text" name="">
I think the problem lies in the line following line:
<input type="text" name="<?php echo $_SESSION['item'][1];?>">
I've bolded the part I added, I think that should solve your problem.
Chad