467,915 Members | 1,528 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

[SOLVED] Retrieve value from one phpfile to another.

sir,
i am starting working with php.i done some programs.but now i have one problem.i do a program like to retrieve the name and email from a phpfile to another.but i can't get.

this is the code "form.php"

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>HTML Form</title>
</head>

<body>
<!-- Script 2.1 - form.html -->

<form action="handle_form.php" method="post">

<fieldset><legend>Enter your information in the form below:</legend>

<p><b>Name:</b><input type="text" name="name" size="20" maxlength="40"/></p>

<p><b>Email Address:</b><input type="text" name="email" size="40" maxlength="60"/></p>
<p><b>Gender:</b><input type="radio" name="gender" value="M"/>Male
<input type= "radio" name="gender" value="F"/>Female</p>
<p><b>Age:</b>
<select name="age">
<option value="0-30">under 30</option>
<option value="30-60">Between 30 and 60</option>
<option value="60+">Over 60</option>
</select></p>
<p><b>Comments:</b><textarea name="comments" rows="3" cols="50"></textarea></p>
</fieldset>
<div align="center"><input type="submit" name="submit" value="Submit Information"/></div>
</form>



</body>
</html>

and this is the code of "handle__form.php"

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Form Feedback</title>
</head>

<body>
<?php #Script 2.2 - handleform.php


// Printing the appropriate message based on the event handle in the form.php

echo "Thankyou, <b>$name</b> for the following comments : <tt> $comments</tt><p> We will reply to you at <i>$email</i>.</p>";




?>
</body>
</html>

i got the output like this

Thankyou, for the following comments :

We will reply to you at .


no information about the name ,comment and email.
to get this what changes have to done ?

please give the details
by linto
thanks in advance
Oct 13 '06 #1
  • viewed: 1770
Share:
3 Replies
ronverdonk
Expert 4TB
Since you are not new to this forum, you know that code should be posted within the appropriate php, html or code tags. See the Posting Guidelines or, when you are replying in the msg editor, the REPLY GUIDELINES at the right side of the screen.

You cannot expect members to wade throught a lot of unstructured code lines.

Ronald :cool:
Oct 13 '06 #2
In handle_post.php write the following code

$name=$_POST['name'];
$emal=$_POST['email'];
$gender=$_POST['gender'];
$age=$_POST['age'];
$comments=$_POST['comments'];

echo $name;

and now you can test whether the values are being posted or not
Oct 14 '06 #3
hello sir,
thanks for giving the solution.now i am working PHP nicely.thanks for all.
Oct 18 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Andreas Paasch | last post: by
2 posts views Thread by epigram | last post: by
4 posts views Thread by Jay | last post: by
6 posts views Thread by Jeff | last post: by
4 posts views Thread by Jeff | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.