Posting data

Alexej Kubarev

New member
The best way to do this will be having a form with method="POST" and getting those variables by using $_POST['var_name_here']

if you use method="get" -- you will have to take variables from the url as they will be posted there.. therefore you will need to use $_GET['var_name_here'] instead

note that you have to specify action="second_page_name.php" in your from tag.

the sample html will look like this:
<form action="second_page.php" method="post">
<input name = "field_1" type="text">

the sample php code of the second_page.php will most probably be:
echo ("The field_1 value is: ".$_POST['field_1']);

Hope this helps..
I believe you can accomplish this one of two ways:

You can add "hidden" tags to carry over the Variable value. from your form page :: ie.

<input type=hidden name=timestamp <?php $dte=date("d/m/Y H:i:s");echo "value='$dte'";?>>
<input type=hidden name=name value=<?php $_POST['name'];?>>

or you can:
At the top of your PHP process code page, before you try and process the variables you need to post them to the page.

$name = $_POST['name'];
$dte = date("d/m/Y H:i:s");
$timestamp = $dte;

echo '$name';
if ('$name')
$sql_host = "";
$sql_uname = "root";
$sql_pass = "";
$database = "guest_book";


etc ...
Bill bones: belive you r code is a bit wrong as what matterhorn wants to do is use varialbes posted FROm the form to the query

by the way: # $result = mysql_db_query("guest_book", $query) or die(mysql_error()); would be pretty good for you to use :D