RLJ Posted September 29, 2010 Share Posted September 29, 2010 Hi, I have a simple html file as follows: <html> <body> <form method="GET" action="retrieve.php"> First Name: <input type="text" name="first_name" size="25" maxlength="25"> Last Name: <input type="text" name="last_name" size="25" maxlength="25"> <input type="submit" /> </form> </body> </html> that sends data to retrieve.php, which is as follows: <?php $first_name = GET["first_name"]; $last_name = GET["last_name"]; ?> very simple, I know, but I keep getting a parse error when I try to run it. Please help! I've tried all sorts of variations on the syntax, but nothing will work. It's probably a very stupid mistake I am making, but if someone sees it, please tell me! Many thanks. Link to comment https://forums.phpfreaks.com/topic/214736-_get-parse-error/ Share on other sites More sharing options...
Psycho Posted September 29, 2010 Share Posted September 29, 2010 You are referencing the GET values incorrectly. You are missing the "$_". I would suggest also using trim(). $first_name = trim($_GET["first_name"]); $last_name = ($_GET["last_name"]); Link to comment https://forums.phpfreaks.com/topic/214736-_get-parse-error/#findComment-1117238 Share on other sites More sharing options...
RLJ Posted October 2, 2010 Author Share Posted October 2, 2010 Thanks! I must have been tired...... Link to comment https://forums.phpfreaks.com/topic/214736-_get-parse-error/#findComment-1118260 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.