Forum Moderators: coopster
<form action="insert.php" method="post">
<table id="form">
<tr>
<td >Photographer's Name
<input type="text" name="PhotgrapherName"/></td>
</tr>
<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ACTC", $con);
$result = mysql_query("SELECT * FROM event_schedule");
echo "<table border=1>
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td><input type="checkbox" name="Events[]" value="<?php echo $row['id'] ?>" ></td>
<td> <?php echo $row['Date'] ?> </td>
<td> <?php echo $row['Time'] ?> </td>
<td> <?php echo $row['Location'] ?> </td>
<td width="300px"> <?php echo $row['EventDescription'] ?> </td>
<td> <?php echo $row['Photographer'] ?> </td>
</tr>
<?php
}
?>
</table>
<?php
mysql_close($con);
?>
<tr>
<td><br/><input name="submit" type="submit" value="Submit"> <input name="reset" type="reset" value="Reset"></td>
</tr>
</table>
</form> <?php
$con = mysql_connect("localhost","root","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ACTC", $con);
$PhotgrapherName = $_POST['PhotgrapherName'];
foreach ($_POST['Events'] as $entry)
{
$query = "UPDATE event_schedule SET Photographer = '$PhotgrapherName' WHERE id = '$entry'" ;
}
if (!mysql_query($query,$con))
die('Error: '. mysql_error());
echo "The schedule has been updated<br />";
echo "<a href='index.php'>Back to table</a>";
mysql_close($con);
?>
echo "<table border=1>
while($row = mysql_fetch_array($result))
echo "<table border=1>";
while($row = mysql_fetch_array($result))
$PhotgrapherName = mysql_real_escape_string(strip_tags($_POST['PhotgrapherName']));
foreach (mysql_real_escape_string(strip_tags($_POST['Events'])) as $entry)
UPDATE event_schedule SET Photographer = 'Name' WHERE id = '3' $PhotgrapherName = mysql_real_escape_string(strip_tags($_POST['PhotgrapherName']));
foreach (mysql_real_escape_string(strip_tags($_POST['Events'])) as $entry)
foreach ($_POST['Events'] as $entry)
{
$query = "UPDATE event_schedule SET Photographer = '$PhotgrapherName' WHERE id = '$entry'" ;
mysql_query($query, $con) or die(mysql_error());
}