I have an page on my site where users login and enter there own data to a data base using this code:
<?
include('auth.php');
include('db.php');
$result = @mysql_query("SELECT event FROM event");
$result2 = @mysql_query("SELECT Player FROM Player");
if (!$result) {
exit('<p>Error performing Event query: ' . mysql_error() . '</p>');
}
if (!$result2) {
exit('<p>Error performing Pros query: ' . mysql_error() . '</p>');
}
?>
Pick Your Team:
<form action="session.php" method="post">
Event Name:
<select name="event">
<option value=""></option>
<?
while ($row = mysql_fetch_array($result))
{
?>
<option value="<?=$row['event'];?>"><?=$row['event'];?>
</option>
<?
}
?>
</select>
<br><br>
<form action="session.php" method="post">
Poker Pro:
<select name="Player">
<option value=""></option>
<?
while ($row = mysql_fetch_array($result2))
{
?>
<option value="<?=$row['Pros'];?>"><?=$row['Pros'];?>
</option>
<?
}
?>
</select>
<br><br>
<input type="submit" value="Add Player to Event">
</form>
Everything is working for this code to enter the selected data to my data base except I can not get it to post the Users ID with the data so I can sort the data by User ID.
Here is the code from session.php
<?
include ("db.php");
mysql_connect or die(mysql_error());
mysql_select_db("my_database") or die(mysql_error());
$event=$_POST['event'];
$name=$_POST['Player'];
$sql="INSERT INTO picks SET UserID='$UserID', event='$event', Pros='$Pros' ";
if (@mysql_query($sql))
?>
In the picks table it is listing in the UserID field the UserID as 0 insted of giving it the correct UserID.
What do I need to do to fix this so each users ID is entered with his data entry.
Thanks,
![]()






Bookmarks