Jump to content

Archived

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

ahmed17

this form -> (html combing php )not work

Recommended Posts

hello , this form -> (html combing php )not work 
it take user name and address and preview it in other page
  what is the problem  in this script ..i test it in local and remote server but not work


html code :

[code]<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
      <title>Title here!</title>
</head>
<body>
<form action="test.php">
<pre>
<b>enter user name</b>    <input type="text" name="user">
<br><br>
<b>enter your address</b> <textarea name="address" rows="5" cols="40" ></textarea>
<br> <br>                    <input type="submit" value="press here ">
</form>
</body>
</html>[/code]



_____________
php code
_____________
[code]
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
      <title>Title here!</title>
</head>
<body>
<?php
print"<pre>";
print "welcome  :$user <br>";
print"your address is :$address";
?>
</body>
</html>[/code]

Share this post


Link to post
Share on other sites
Try this, change the <form> tag on your HTML page to this:

[code]<form action="test.php" method="get">[/code]

Then change your variable names in test.php to this...

[code]echo "welcome  :$_GET['user'] <br>";[/code]

Regards
Rich

Share this post


Link to post
Share on other sites
Your form looks fine, so long as you changed the previous line as suggested.

Make this your test.php code (copy and paste it if you have to):

[code]
<?php
  $user = $_GET['user'];
  $address = $_GET['address'];
?>
<html>
<head>
  <title>Title here!</title>
</head>
<body>
  <pre>
  Welcome : <?php echo $user; ?><br>
  Your address is : <?php echo $address; ?>
  </pre>
</body>
</html>
[/code]

If this doesn't work, perhaps you could tell us what IS happening.  Do you definitely have PHP installed.  If you create a page called info.php and code it like this...

[code]
<?php
phpinfo();
?>
[/code]

Do you get a full PHP output?

Regards
Rich

Share this post


Link to post
Share on other sites

×

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.