Hey Guys so basicly I have mutilps value boxes -
What is the best way of doing the _REQUEST on the other page and then inserting them values into a database.
Display page:
<?php
include ('includes/connection.php');
$i = 0;
$a = 0;
$loop = 0;
$search[] = NULL;
include("includes/header.php");
include("includes/htmlhead.php");
$date = isset($_REQUEST["date1"]) ? $_REQUEST["date1"] : "";
$cus_id2 = NULL;
$just_added = 0;
if($date != NULL){
$date1 = explode("-", $date);
}
?>
<h1 align="center">
<br />
<br />
<br />
<br />
<br />
Assign Engineers to Customers:
</h1>
<br/>
<br />
<br /> <h2>
Date selected: <?php echo $date1[2]."-".$date1[1]."-".$date1[0]; ?> </h2> <br /> <br />
<table width="70%" border="1">
<form action="ass_eng_2.php" method="post" enctype="application/x-www-form-urlencoded">
<?php
$query = "SELECT FName, LName, engineer_id FROM engineer WHERE level_of_access = '2';";
//echo $query."<br/>";
$result = mysql_query($query);
check($result);
while ($row = mysql_fetch_array($result)) {
$eng_fname = $row[0];
$eng_lname = $row[1];
$eng_id = $row[2];
?>
<td rowspan="7" width="20%"><?php echo $eng_fname." ".$eng_lname;?> </td>
<?php while($i != 7){ ?>
<td>
<select id="<?php echo $eng_id; ?>">
<option value=""> assign engineer </option>
<?php
$query2 = "SELECT cus_id, FName, LName FROM customer WHERE case_closed = 'no';";
// echo $query2."<br/>";
$result2 = mysql_query($query2);
check($result2);
while ($row = mysql_fetch_array($result2)) {
$cus_id1 = $row[0];
$fName = $row[1];
$lName = $row[2];
$query1 = "SELECT a.cus_id FROM type_of_install a LEFT JOIN customer_call c ON a.cus_id = c.cus_id WHERE engineer_id = '".$eng_id."' AND agreed_date = '".$date."' AND a.cus_id = '".$cus_id1."' OR engineer_id2 = '".$eng_id."' AND agreed_date = '".$date."' AND a.cus_id = '".$cus_id1."';";
$result3 = mysql_query($query1);
check($result3);
while ($row = mysql_fetch_array($result3)) {
$cus_id2 = $row[0];
if($just_added == 0){
if(in_array($cus_id2,$search)){
}else{
$search[$loop] = $cus_id1;
$loop = $loop + 1;
//$q1 = $query1;
$just_added = 1;
?> <option value="$cus_id2" selected="selected"> <?php echo $fName." ".$lName; ?> </option>
<?php
}
}
}
?>
<option value=""> <?php echo $fName." ".$lName; ?> </option>
<?php
} $just_added = 0; ?>
</select>
</td>
</tr>
<tr>
<?php $i++;
}
$i = 0;
$loop = 0;
$search[] = NULL;
$a = $a + 1;
} ?>
<tr> <td colspan="2" align="right"> <input name="submit" type="submit" value="submit" /> </td> </tr> </form> </table> </body>
</html>
Update page:
<?php
include ('includes/connection.php');
include("includes/header.php");
$i = 0;
//$end_id[] = NULL;
$id = $_REQUEST[(WHAT VALUE GOES HERE?];
$query = "SELECT cus_id FROM customer WHERE case_closed = 'no';";
$result = mysql_query($query);
check($result);
while ($row = mysql_fetch_array($result)) {
$cus_id1 = $row[0];
// $id[$i] = $_REQUEST[''];
}
echo $id;
// $_SESSION['eng_ass'] = "true";
// header("Location: ass_eng.php");
?>