hello everybody,
I have a quick question that i'm having problems with.
This script does a few things: allows a user to edit/delete information from DB, as well as Adding new information:
My problem is with the ADDING Part: (note form at the end of the script).
What i need is the user to enter $rows number and then pass that info as a URL.....i have the destination page all set, and i just need help in passing the information properly.
<?php
$db=mysql_connect("...", "....", "....");
mysql_select_db("....",$db);
if($run_id){
if($submit){
$sql = "UPDATE ...... SET run_id='$run_id',club='$club',first='$first',last='$last',age='$age',sex='$sex',race='$race' WHERE run_id=$run_id";
$result=mysql_query($sql);
header("Location:[url]http://............/edit.php?clubname=[/url]".$club."");
//echo"Thank you! Information updated.\n";
//echo "<meta http-equiv='refresh' content='5; url=http://........./edit.php?clubname=".$clubname. ">";
}elseif ($delete){
// delete a record
$sql = "DELETE FROM ...... WHERE run_id=$run_id";
$result = mysql_query($sql);
echo "$sql Record deleted!<p>";
} else {
$sql="SELECT FROM runner WHERE run_id=$run_id";
$result=mysql_query($sql);
$myrow=mysql_fetch_array($result);
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<input type=hidden name="run_id" value="<?php echo $myrow["run_id"]?>">
Club: <input type="text" name="club" value="<?php echo $myrow["club"]?>"><br>
First: <input type="text" name="first" value="<?php echo $myrow["first"]?>"><br>
Last: <input type="text" name="last" value="<?php echo $myrow["last"]?>"><br>
Age: <input type="text" name="age" value="<?php echo $myrow["age"]?>"><br>
Sex: <input type="text" name="sex" value="<?php echo $myrow["sex"]?>"><br>
Race: <input type="text" name="race" value="<?php echo $myrow["race"]?>"><br>
<input type="Submit" name="submit" value="Enter Information">
</form>
<?php
}
}else{
$query = "SELECT FROM runner WHERE club='$clubname'";
$result = mysql_query($query);
echo "<table width=100% border=0>";
echo "<tr><td></td><td><center><font size=+2 color=red> Club Name: ".$clubname."</font></center></td><td></td></tr>";
echo "<tr><td></td><td><hr></td><td><br><br></td></tr>";
echo "<tr><td><b>Click Name to EDIT</b></td><td><b>Additional Info</b></td></td><td><b>DELETE this Runner</b></td></tr>";
while ($myrow = mysql_fetch_array($result)){
printf("<tr><td><a href=\"%s?run_id=%s\">%s %s</a></td><td>%s %s %s\n</td>", $PHP_SELF, $myrow["run_id"], $myrow["first"], $myrow["last"], $myrow["age"], $myrow["sex"], $myrow["race"]);
printf("<td><a href=\"%s?run_id=%s&delete=yes\">DELETE</a></td></tr>", $PHP_SELF, $myrow["run_id"]);
}
echo "</table>";
//ADD AREA here
echo "<table><tr><td><br><br><br><br><br><b><font color=red size=+1>ADD MOREfont>";
echo "<form method=\"post\" action=$PHP_SELF>
<center>
<table>
<tr>
<td>How Many New Entries:</td>
<td><input type=\"text\" name=\"rows\" size=\"5\"></td>
</tr>
<tr>
<td colspan=\"2\">
<p align=\"center\"><input type=\"submit\" value=\"Submit\" name=\"submit\"></td>
</tr>
</table>
</center>
</form>";
echo "</td></tr></table>";
}
?>
How do i get the "rows" variable passed to another page with out discrupted the rest of the page?
-Michael