DJJama
03-20-2010, 04:34 PM
Hi guys, my project is moving along.
This code is supposed to allow a user (userid should be taken from the session) to select a race from another table via a drop down box and submit it to update the record.
I have got it to display and show the races, and when i submit it does go to the add section but does not actually do anything.
I think it is to do with it not receiving a user from the sesh.
<?php
require("includes/sesh.inc");
require("includes/header.inc");
require("includes/db.inc");
require("includes/menu.inc");
$currentuser = $_SESSION['uid'];
echo "<h1>Run Selection</h1>";
echo $currentuser;
echo "</br>";
echo "</br>";
if(isset($_GET['add']))
{
$i = $_POST['rid'];
$r = $_POST['rname'];
$query= "UPDATE userdetails
SET racetrainingfor = '($r)'
//WHERE userdetails.userid = $currentuser";
mysql_query($query);
echo "<p>Race Selected</p>";
}
echo "<form action='selectrun.php?add=yes' method='post'>";
echo "<select name='rname'>";
$query1 = "SELECT * FROM rundetails";
$result = mysql_query($query1);
while ($row = mysql_fetch_array($result))
{
extract($row);
echo"<option value='".$runid."'> ".$runname." </option>";
}
echo "</select>";
echo "<input type='submit' value='Select Race'></p>";
echo "</form>";
require("includes/footer.inc");
?>
This code is supposed to allow a user (userid should be taken from the session) to select a race from another table via a drop down box and submit it to update the record.
I have got it to display and show the races, and when i submit it does go to the add section but does not actually do anything.
I think it is to do with it not receiving a user from the sesh.
<?php
require("includes/sesh.inc");
require("includes/header.inc");
require("includes/db.inc");
require("includes/menu.inc");
$currentuser = $_SESSION['uid'];
echo "<h1>Run Selection</h1>";
echo $currentuser;
echo "</br>";
echo "</br>";
if(isset($_GET['add']))
{
$i = $_POST['rid'];
$r = $_POST['rname'];
$query= "UPDATE userdetails
SET racetrainingfor = '($r)'
//WHERE userdetails.userid = $currentuser";
mysql_query($query);
echo "<p>Race Selected</p>";
}
echo "<form action='selectrun.php?add=yes' method='post'>";
echo "<select name='rname'>";
$query1 = "SELECT * FROM rundetails";
$result = mysql_query($query1);
while ($row = mysql_fetch_array($result))
{
extract($row);
echo"<option value='".$runid."'> ".$runname." </option>";
}
echo "</select>";
echo "<input type='submit' value='Select Race'></p>";
echo "</form>";
require("includes/footer.inc");
?>