|
Posted by robert on 05/31/06 20:22
"Martin Jay" <martin@spam-free.org.uk> wrote in message
news:KiiOMoDjXffEFwAK@spam-free.org.uk...
| In message <447dd9b0$1_3@filemon2.isp.telecable.es>, ivo
| <nomail@here.com> writes
| >Hope you can help me :P
| >
| >I'm coding an html form with some php vars. Something like this doesn't
| >work:
| >
| > <form action="./correct.php" method="post">
| > (xxxxx) <input type="hidden" name="preg1" value="'. $preg .'">
| > <input submit.....>
| > </form>
| >
| >And then in correct.php:
| >echo $_POST["preg1"]
| >
| >But if I substitute the line (xxxxx) with this it works!
| ><input type="hidden" name="preg1" value="sometexthere">
| >
| >What can I do to make it works using $preg var??
|
| You need to echo $preg to incorporate its value in the HTML element, for
| example change:
|
| <input type="hidden" name="preg1" value="'. $preg .'">
|
| to:
|
| <input type="hidden" name="preg1" value="<?php echo $preg; ?>">
<op, ignore following line>
that is of course, assuming the $preg WAS a var and that globals was turned
on. another winner, wart! you assume too much, have to little information
yet, love making shots in the dark! i applaude you consistent stupidity!
<ok, here's the problem>
ivo, the name(s) of your inputs in your form will produce $_POST variable
values. your code shows you referencing that correctly. in your example
code, your input's name is "preg1". the value is being set to $preg which is
a variable that doesn't exist as far as your example shows.
where is $preg being set? here's a test...
use the xxxxxx line however just above it, set $preg =
'sometexthere'...you'll notice the test works the same as your substituted
line.
you simply need to find where $preg is being set...right now, it's not.
Navigation:
[Reply to this message]
|