cluce Posted April 26, 2007 Share Posted April 26, 2007 I have one page called home.html with the following code: <A HREF="http://localhost/welcome.php"> Hi, I'm Kevin! </A> <FORM ACTION="http://localhost/welcome.php" METHOD=post> First Name: <INPUT TYPE=TEXT NAME="firstname"><BR> Last Name: <INPUT TYPE=TEXT NAME="lastname"> <INPUT TYPE=SUBMIT VALUE="GO"></FORM> and the other page is called welcome.php and has the following code: <HTML> <HEAD> <TITLE>Today's Date</TITLE> </HEAD> <BODY> <p>welcome to my site</p> <P>Today's Date (according to this Web server) is <?php echo( "Welcome to our Web site,$firstname $lastname!" ); ?> </BODY> </HTML> everything loads fine but the firstname and lastname entered is not showing. I am puzzled. I cant see where the error is. can someone please help? thanks in advance Link to comment https://forums.phpfreaks.com/topic/48820-solved-trouble-passing-inputed-data-from-one-page-to-another/ Share on other sites More sharing options...
mpharo Posted April 26, 2007 Share Posted April 26, 2007 #1. Never use localhost, use the whole site name or relitave path to the file... #2. The variables are passed using the $_POST[] method, so in your case you can access your 2 variables like this... <?php echo( "Welcome to our Web site,$_POST[firstname] $_POST[lastname]!" ); ?> Link to comment https://forums.phpfreaks.com/topic/48820-solved-trouble-passing-inputed-data-from-one-page-to-another/#findComment-239271 Share on other sites More sharing options...
bobleny Posted April 26, 2007 Share Posted April 26, 2007 You may also consider a code clean up. Your html is a bit out of date... Have you ever looked at xhtml? http://www.w3schools.com/xhtml/ Link to comment https://forums.phpfreaks.com/topic/48820-solved-trouble-passing-inputed-data-from-one-page-to-another/#findComment-239280 Share on other sites More sharing options...
cluce Posted April 26, 2007 Author Share Posted April 26, 2007 thanks a million. that was it Link to comment https://forums.phpfreaks.com/topic/48820-solved-trouble-passing-inputed-data-from-one-page-to-another/#findComment-239289 Share on other sites More sharing options...
cluce Posted April 26, 2007 Author Share Posted April 26, 2007 well that was just an simple example I created to make it easy to read. I have the complex code through Dreamweaver 8 in a website I am working on. But I will check out that website. Thanks Link to comment https://forums.phpfreaks.com/topic/48820-solved-trouble-passing-inputed-data-from-one-page-to-another/#findComment-239296 Share on other sites More sharing options...
mpharo Posted April 26, 2007 Share Posted April 26, 2007 whats outdated about his html? he is just using the basic tags...html...head...body...along with basic inputs....nothing outdated about it.? Link to comment https://forums.phpfreaks.com/topic/48820-solved-trouble-passing-inputed-data-from-one-page-to-another/#findComment-239409 Share on other sites More sharing options...
bobleny Posted April 27, 2007 Share Posted April 27, 2007 whats outdated about his html? he is just using the basic tags...html...head...body...along with basic inputs....nothing outdated about it.? slandered html is becoming out of date. There are almost no rules. As a result, different browsers will display html different in some cases... XHTML is becoming the new standard. http://www.w3schools.com/xhtml/xhtml_intro.asp More info: http://www.w3.org/TR/xhtml1/ Link to comment https://forums.phpfreaks.com/topic/48820-solved-trouble-passing-inputed-data-from-one-page-to-another/#findComment-239469 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.