Page 1 of 1

Getting values with $_POST [solved]

Posted: Wed Aug 03, 2005 7:05 am
by carlo1
I have been asked to update a website, so it can handle register globals=off, so i've been putting a lots of $_POST[ ], but now i've rum into a problem.
This is part of a form at the site:

Code: Select all

<input type="hidden" name="no<?php print $i ?>" value="<?php print $db->f(no); ?>" >
</td>
<td><?php print $db->f(description); ?>
<input type="hidden" name="besk<?php print $i ?>" value="<?php print $db->f(description); ?>" >
</td>
<td>
<input type="text" name="ant<?php print $i ?>" value="<?php if(isset(${"ant".$i})) print ${"ant".$i}; ?>" style="width:40">

My problem is the last line. The ${"ant".$i} won't work with register globals=off. How do get the value of that variable? I've been trying to add some $_POST varius places but it doesn't seem to work. Does anybody know how solve this?


feyd | please use

Code: Select all

tags when posting php code..[/color]

Posted: Wed Aug 03, 2005 8:36 am
by onion2k
$_POST['ant'.$i] works fine. Make sure $i in your check is the same as $i in the bit that writes the HTML.

Posted: Thu Aug 04, 2005 1:52 am
by carlo1
Thank you! Works great!