Forum Moderators: coopster
The president you voted for was_____
The vice president you voted was ____
To do this I will create a table with the user starts to vote creating a voter ID.. then I would like to be able to query the table on that page but I am not sure how I will match up the table with the above format.
Any help would be greatly appreciated.
[edited by: jatar_k at 4:36 am (utc) on Nov. 4, 2003]
[edit reason] spliced 2 posts together [/edit]
For tracking and keeping state across several pages sessions are most common with PHP.
But of course you could also use a table to keep track of a user's activities, and a session could the be used to identify the user.
The PHP documentation has some information about sessions.
Hope this helps ...
The president you voted for was_____
The vice president you voted was ____
To do this I will create a table with the user starts to vote creating a voter ID.. then I would like to be able to query the table on that page but I am not sure how I will match up the table with the above format.
Any help would be greatly appreciated.
<?php
session_start();
$_SESSION['pres_id']= $pres_id;
?>
Then on the page you want to view it (and all pages on the site must have session_start said or else the session will fail)
<?php
session_start();
$pres_id= $_SESSION['pres_id'];
if($pres_id=='1')
{
$pres_name= 'George Washington';
}
elseif($pres_id=='2')
{
$pres_name= 'John Adams';
}
?>
You get the idea. Plus if its stored in a mysql table, you can use the following code to get started with that.
<?php
$sql = "SELECT * FROM table WHERE pres_id = $pres_id";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
print $row['name'];
?>
I gave you some info to start with, have fun with it. Change it, intermingle it and learn from it! ^^