I'm new to php and I'm playing around with forms, but for some reason the input into my forms are not getting to the php scripts. I'm using method="post" in my form. I've tried to cut and past a couple of forms from various sites that have tutorials but it doesnt seem to work. Would anyone be able to provdie some code that allows you to just enter data into a form and display the data from the form.
try this, save as test.php
<? if (isset($testdata)) { echo $testdata; } ?>
<form action="test.php" method="post" name="test> Input text: <input type="text" name="testdata"><br> <input type="submit" value="submit"> </form>
hi,
won't do. you will have to tell php that $testdata is posted data. so->
<?php if (isset($POST['testdata'])) { $testdata = $POST['testdata']; echo $testdata; } else { echo ("no data"); } ?>
need a " after name="test but the rest should work
Al
it will only work if register_globals in php.ini is set to "on". But this is default set to "off" because of security problems in PHP4.x
my bad !