PDA

View Full Version : Form "POST" not passing on


Enverex
22 Jun 2003, 09:14 PM
Trying to get a form to pass some data on, but its just not working.

Apparently the name of the entry box becomes the variable the value is stored in when the form gets passed on, but it doesnt seem to be working......

Form -
<form method="post" action="searcher.php">
<input type="text" name="GN">
<input type="reset" value="Clear">
<input type="submit" value="Find Game">
</form>

Passed on to -
<?php
echo $GN;
?>

Just does -
<b>Notice</b>: Undefined variable: GN in <b>C:\http\ac\amiga\searcher.php</b> on line <b>2</b>

Any ideas? As there is no reason that this shouldnt be working afaikt, as I have looked up about 500 examples now....

NS

versello
23 Jun 2003, 08:22 AM
Your text input has no value. It should read

< input type="text" name="GN" value="" >

Enverex
23 Jun 2003, 10:45 AM
Value just states the initial value, i.e. If I put
value="cheese"
in the text box then when the page loads, it will just say "Cheese".

NS

Meltdown
25 Jun 2003, 08:26 AM
Try
<?php
$GN = $_POST['GN'];
echo $GN;
?>


The basic info came from php.net tutorial (http://www.php.net/manual/en/tutorial.forms.php).
I just started messing with php a few days ago so there may be a better solution.

ElectusUnum
25 Jun 2003, 02:52 PM
I would just use $_POST['GN'] instead of copying it to a new variable. Saves memory, but I'm weird like that (a few bytes of text won't matter, but I must have every nanosecond of speed!)

Enverex
30 Jun 2003, 11:39 PM
Ah, as I was looking at something that said it was HTTP_GET_FORMDATA_SOME_OTHER_STUFF_THAT_WAS_WRONG['doesntmatteritsallwronganyway']

So cheers for clearing that up. Yeah, globals is staying off.

Oh, read the bottom server message - http://atomnet.co.uk/pagethatdoesntahja

NS

Enverex
4 Jul 2003, 07:19 PM
w00t

http://atomnet.co.uk/amiga/?p=engine&module=search

Enter 'world' or 'cannon' or something :p

Cheers all,
NS