@StarLion,
Thanks for the suggestion. I've modified the code as follows:
Code:
<?php
include_once '/home/tgitcorp/includes/dbconn.php';
if(isset($_POST['ddlStore']))
{
$restaurantid = $_POST ['ddlStore'];
$jobtype = $_POST ['jobs'];
$stmt = mysqli_stmt_init ( $mysqli );
$sql = 'Insert into `OpenJobs`(`restaurantid`,`jobid`) Values(?,?)';
if (mysqli_stmt_prepare ( $stmt, $sql )) {
mysqli_stmt_bind_param ( $stmt, "ss", $restaurantid, $jobtype );
mysqli_stmt_execute ( $stmt );
printf ( "%d Row Inserted.\n", mysqli_stmt_affected_rows ( $stmt ) );
mysqli_stmt_close ( $stmt );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Tricorp Job Listing Admin Panel</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
</head>
<body>
<h1>Job Listing Administration</h1>
<h2>Step 1: Please Select Your Restaurant</h2>
<form id="frmSelStore" method="post" action="admin_index.php">
<fieldset><?php
$query="SELECT restaurantid,location from restaurant";
$result = mysqli_query($mysqli,$query);
echo '<select name="ddlStore">';
while($row=mysqli_fetch_array($result))
{
echo '<option value="' . htmlspecialchars($row['restaurantid']) . '">' .
htmlspecialchars($row['location']) .
'</option>';
}
echo '</select>';
?>
<h2>Step 2: Please Select the Jobs to be Posted</h2>
<input type="checkbox" name='[jobs]' value="2" id="cbJobs1">Host/Hostess
</input><br/>
<input type="checkbox" name='[jobs]' value="4" id="cbJob2">Bartender</input><br/>
<input type="checkbox" name='[jobs]' value="1" id="cbJob3">Server</input><br/>
<input type="checkbox" name='[jobs]' value="3" id="cbJobs4">Cook</input><br/>
<input type="submit" id="submit"/>
</fieldset>
</form>
</body>
</html>
Despite adding $stmt as the first argument in the mysqli_stmt_bind_param, I still receive the following error when browsing the page:
The requested URL /Admin/<br /><b>Warning</b>: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, string given in <b>/home/tgitcorp/public_html/Admin/admin_index.php</b> on line <b>25</b><br />0 Row Inserted. was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Is there a better way to structure the $stmt variable?
Thanks,
Sid
Bookmarks