Jump to content

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]
Link to comment
https://forums.phpfreaks.com/topic/19919-this-form-html-combing-php-not-work/
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
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
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.