Mackey18 Posted September 20, 2009 Share Posted September 20, 2009 I was doing some tutorials for PHP when i hit this little snag. In one html file i wrote this: <FORM ACTION="welcome.php" METHOD=GET> First Name: <INPUT TYPE=TEXT NAME="firstname"><BR> Last Name: <INPUT TYPE=TEXT NAME="lastname"> <INPUT TYPE=SUBMIT VALUE="GO"> </FORM> Then I linked it to a PHP file with the code: <?php echo( "Welcome to our Web site, $firstname $lastname!" ); ?> <P>Today's Date (according to this Web server) is <?php echo( date("l, F dS Y.") ); ?> However instead of saying: "Welcome to our Web site, Joe Bloggs!" it says "Welcome to our Web site, !" Any ideas where i'm going wrong? I'm doing all of this on a local server. Link to comment https://forums.phpfreaks.com/topic/174878-php-query-isnt-working/ Share on other sites More sharing options...
trq Posted September 20, 2009 Share Posted September 20, 2009 Whatever tutorials your reading are VERY old and rely upon register_globals being on. This has been off by default for over 7 years. Change... echo( "Welcome to our Web site, $firstname $lastname!" ); to.... echo "Welcome to our Web site, " . $_GET['firstname'] . " " . $_GET['lastname']} . "!"; Link to comment https://forums.phpfreaks.com/topic/174878-php-query-isnt-working/#findComment-921618 Share on other sites More sharing options...
Mackey18 Posted September 20, 2009 Author Share Posted September 20, 2009 Sadly this didn't work as now the page is completely blank! Link to comment https://forums.phpfreaks.com/topic/174878-php-query-isnt-working/#findComment-921620 Share on other sites More sharing options...
ozestretch Posted September 20, 2009 Share Posted September 20, 2009 see the } ? remove it Link to comment https://forums.phpfreaks.com/topic/174878-php-query-isnt-working/#findComment-921623 Share on other sites More sharing options...
Mackey18 Posted September 20, 2009 Author Share Posted September 20, 2009 Wow it worked!!! Thank you so much!!! So why didn't the code that came with the tutorial work, I mean surely they tested it before putting it up there?!?! Link to comment https://forums.phpfreaks.com/topic/174878-php-query-isnt-working/#findComment-921624 Share on other sites More sharing options...
ozestretch Posted September 20, 2009 Share Posted September 20, 2009 Wow it worked!!! Thank you so much!!! So why didn't the code that came with the tutorial work, I mean surely they tested it before putting it up there?!?! [*]When it was posted, it probably worked great. Technology changes alot over a short period of time (php6 will be here before we know it) [*]Often tutorials are posted untested (and snippets in forums ) Link to comment https://forums.phpfreaks.com/topic/174878-php-query-isnt-working/#findComment-921629 Share on other sites More sharing options...
Mackey18 Posted September 20, 2009 Author Share Posted September 20, 2009 Ye it was made in 2001. It's a mySql tutorial, so if you guys know MySQL and I hit another snag i'll post it on here Thanks Again Link to comment https://forums.phpfreaks.com/topic/174878-php-query-isnt-working/#findComment-921630 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.