index.php
contains the form where user enters the information
process.php
contains the code where it print out all the information
i just wondering how can i pass the information from index.php to process.php.
passing value to another page
Moderator: General Moderators
.... or URL or cookie
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
Code: Select all
<form method="post" action="process.php">Code: Select all
<form method="get" action="process.php">Heck... I'm bored.
index.php
process.php

index.php
Code: Select all
<form action="process.php" method="post">
<input type="hidden" name="flag" value="index">
<input type="text" name="foo" size="10">
<input type="text" name="bar" size="10">
<input type="submit" value="Submit">
</form>Code: Select all
if($_POST['flag'] == "index")
{
// All of your variables are now here, in $_POST, you could uhhh.. do whatever you want with them.
$foo = $_POST['foo'];
$bar = $_POST['bar'];
// perhaps make them mysql safe?
$foo = mysql_real_escape_string($foo);
$bar = mysql_real_escape_string($bar);
// print them to the browser?
echo $foo."<br />";
echo $bar;
// put them in an array?
$foobar = array('$foo','$bar');
// print the array?
print_r($foobar);
// and various other things
}Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.