Jump to content

[SOLVED] trouble passing inputed data from one page to another


cluce

Recommended Posts

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

 

#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]!" ); ?>

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/

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.