PHP and Session error
Hello I have a problem with a session. When I use a session to pass a variable to another page the values of that variable always still the same in the other page. No matter what row I selected. When I change the "action" to the same page where the variable is, the value shows correct. Sorry for my bad English if someone speak Spanish let my know to explain better. I really need help in this.
Here is my code:
<?php
include_once 'rnheader.php';
session_start();
$ticket_select = $_POST['serviceID'];
echo '<a href = "rnservices.php"> Create Service</a> ';
echo '<table border="1" >';
echo '<tr>';
echo '<th>Service ID</th>';
echo '<th>Title</th>';
echo '<th>Description</th>';
echo '<th>Notes</th>';
echo '<th>Submit By</th>';
echo '<th>Assigned Employee</th>';
echo '<th>Assigned Group</th>';
echo '<th>Category</th>';
echo '<th>Status</th>';
echo '<th>Urgency</th>';
echo '<th>Customer</th>';
echo '<th>Day Created</th>';
echo '</tr>';
$query = ("SELECT ServiceID, Title, Description, Notes, SubmitBy, AssignedEmp, " .
"AssignedGroup, NameCategory, TipoStatus, TiposUrgencia, CustomerName, DayCreation FROM Service");
$result = queryMysql($query);
while ($row = mysql_fetch_assoc($result)) {
echo '<tr>';
echo '<td><form method ="post" action="rnservices1.php">';
?>
<input type="submit" name="serviceID" value=<?php echo $row['ServiceID']?>
<?php
echo '</form>';
echo '<td>'.$row['Title'].'</td>';
echo '<td>'.$row['Description'].'</td>';
echo '<td>'.$row['Notes'].'</td>';
echo '<td>'.$row['SubmitBy'].'</td>';
echo '<td>'.$row['AssignedEmp'].'</td>';
echo '<td>'.$row['AssignedGroup'].'</td>';
echo '<td>'.$row['NameCategory'].'</td>';
echo '<td>'.$row['TipoStatus'].'</td>';
echo '<td>'.$row['TiposUrgencia'].'</td>';
echo '<td>'.$row['CustomerName'].'</td>';
echo '<td>'.$row['DayCreation'].'</td>';
echo '</tr>';
}
mysqli_free_result($result);
echo $ticket_sele开发者_Python百科ct;
$_SESSION['serviceID'] = $ticket_select;
'</table>';
?>
Is it a case issue?
$_SESSION['serviceID'] = $ticket_select;
<input type="submit" name="serviceID" value=<?php echo $row['ServiceID']?>
$ticket_select = $_POST['serviceID'];
Notice the middle one has a capital S on ServiceID and the other two are serviceID.
精彩评论