Hi,
I think you mean that you pass the values from a HTML form in one files/page to a PHP script in another?
If so then the following are 2 files named myform.html and action.php.
The form simply asks for your name and age then sends them to the php script in the action.php file/page.
HTML - MYFORM.HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>My Form</title>
</head>
<body>
<form action="action.php" method="post">
<p>Your name: <input type="text" name="name" /></p>
<p>Your age: <input type="text" name="age" /></p>
<p><input type="submit" /></p>
</form>
</body>
</html>
PHP - ACTION.PHP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Action</title>
</head>
<body>
Hi <?php echo htmlspecialchars($_POST['name']); ?>.
You are <?php echo (int)$_POST['age']; ?> years old.
</body>
</html>
Here I have used the $_POST method. This is far better and more secure than using cookies - which, by the way is another method.
If I am barking up the wrong tree then you may be talking about session queries. If so then here are 2 more files - FORMS2.HTML and QACTIONS.PHP.
NOTE: When qaction.php is invoked take a look at the ADDRESS bar in your browser. You will see the query string.
FORMS2.HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Forms2</title>
</head>
<body>
<form action="qaction.php" method="get">
<input type="text" name="user"/></p>
<textarea name="address" rows="5" cols="40">
</textarea>
<input type="submit" value="send it!" /></p>
</form>
</body>
</html>
QACTION.PHP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Qaction</title>
</head>
<body>
<?php
print "Welcome <b>".$_GET['user']."</b><br/>\n\n";
print "Your address is: <br/><b>".$_GET['address']."</b>";
?>
</body>
</html>
Hope this helps.
Regards.
I think you mean that you pass the values from a HTML form in one files/page to a PHP script in another?
If so then the following are 2 files named myform.html and action.php.
The form simply asks for your name and age then sends them to the php script in the action.php file/page.
HTML - MYFORM.HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>My Form</title>
</head>
<body>
<form action="action.php" method="post">
<p>Your name: <input type="text" name="name" /></p>
<p>Your age: <input type="text" name="age" /></p>
<p><input type="submit" /></p>
</form>
</body>
</html>
PHP - ACTION.PHP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Action</title>
</head>
<body>
Hi <?php echo htmlspecialchars($_POST['name']); ?>.
You are <?php echo (int)$_POST['age']; ?> years old.
</body>
</html>
Here I have used the $_POST method. This is far better and more secure than using cookies - which, by the way is another method.
If I am barking up the wrong tree then you may be talking about session queries. If so then here are 2 more files - FORMS2.HTML and QACTIONS.PHP.
NOTE: When qaction.php is invoked take a look at the ADDRESS bar in your browser. You will see the query string.
FORMS2.HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Forms2</title>
</head>
<body>
<form action="qaction.php" method="get">
<input type="text" name="user"/></p>
<textarea name="address" rows="5" cols="40">
</textarea>
<input type="submit" value="send it!" /></p>
</form>
</body>
</html>
QACTION.PHP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Qaction</title>
</head>
<body>
<?php
print "Welcome <b>".$_GET['user']."</b><br/>\n\n";
print "Your address is: <br/><b>".$_GET['address']."</b>";
?>
</body>
</html>
Hope this helps.
Regards.