Jack.Straw Posted November 2, 2006 Share Posted November 2, 2006 Hello. I'm learning PHP and can't figure out what i'm doing wrong here. I'm trying to learn how to pass variables from a form to PHP, but none of things in the tutorials i've been working with are working as intended. Can you tell me what i'm doing wrong?[code]<HTML><HEAD><TITLE>Learning</TITLE></HEAD><BODY><FORM ACTION="<?php echo $PHP_SELF;?>" METHOD="POST"><INPUT TYPE="text" Name="item" size="20"><INPUT TYPE="submit" NAME="submit" VALUE="Submit"></FORM><?phpif ($submit == "submit") { echo("$item has been submitted"); }?></body></html>[/code]Thanks in advance,-Jack Link to comment https://forums.phpfreaks.com/topic/25952-need-help-with-form-data/ Share on other sites More sharing options...
alpine Posted November 2, 2006 Share Posted November 2, 2006 Your code is relying on register globals being ON, your server/host probably has this OFF as it should be.This means that you must assign each POST (or GET or whatever)Example:[code]<?phpif (isset($_POST['submit'])){ echo "{$_POST['item']} has been submitted";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/25952-need-help-with-form-data/#findComment-118540 Share on other sites More sharing options...
Jack.Straw Posted November 2, 2006 Author Share Posted November 2, 2006 That worked perfectly, thank you so much for your time! Link to comment https://forums.phpfreaks.com/topic/25952-need-help-with-form-data/#findComment-118562 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.