I see what you mean now.
I’ve suggested a rewrite below, which removes a few errors and structures the page in a more logical way. One thing I wasn’t sure of, whilst it isn’t any of my business, is the usability of a form which redirects to a processing page when a select option is changed - what if the user clicked it by accident?
Anyway, here’s a version without the automatic direction but with an update button as an alternative:
<?php
session_start();
include_once("conn.php");
if(isset($_SESSION['username'])){
$Tickets = array();
$AssignOptions = array();
$selectTicketsQuery = mssql_query("SELECT * FROM tblTicket INNER JOIN tblAssign ON tblTicket.TickNo=tblAssign.TicketNo WHERE tblAssign.AssignTo='{$_SESSION['username']}'");
while($Ticket = mssql_fetch_array($selectTicketsQuery)){
$Tickets[] = $Ticket;
}
$Assign = mssql_query("Select * from MISPIC");
while($AssignOption = mssql_fetch_assoc($Assign)){
$AssignOptions[] = $AssignOption;
}
?>
<html>
<head>
<title>Ticket Support</title>
</head>
<body>
<p>Welcome <?php echo $_SESSION['username']; ?>!</p>
<table border='1'>
<tr>
<th>Ticket</th>
<th>User Name</th>
<th>Date</th>
<th>Time</th>
<th>Category</th>
<th>Transfer JO</th>
</tr>
<?php
foreach($Tickets as $Ticket){
echo '<tr>';
echo '<td><a href="Ticketmanage.php?id=', $Ticket['TickNo'], '">', $Ticket['TickNo'], '</a></td>';
echo '<td>', $Ticket['UserName'], '</td>';
echo '<td>', $Ticket['DateCreate'], '</td>';
echo '<td>', $Ticket['TimeCreate'], '</td>';
echo '<td>', $Ticket['Category'], ' (', $Ticket['Subcat'], ')</td>';
echo '<td>';
echo '<form action="Transfer.php" method="get">';
echo '<input type="hidden" name="TicketNo" value="', $Ticket['TickNo'], '" />';
echo '<select name="TransferOption">';
echo '<option value="0">Please Select</option>';
foreach($TransferOptions as $TransferOption){
echo '<option value="', $TransferOption['MISPIC'], '">', $TransferOption['MISPIC'], '</option>';
}
echo '</select>';
echo '<input type="submit" value="Update" />';
echo '</form>';
echo '</td>';
echo '</tr>';
}
?>
</table>
<p><a href='Support.php'>Back</a></p>
</body>
</html><?
}else{ //not logged in
header('location: login.php');
}
If you’re sure that you want the form to automatically submit:
<?php
session_start();
include_once("conn.php");
if(isset($_SESSION['username'])){
$Tickets = array();
$AssignOptions = array();
$selectTicketsQuery = mssql_query("SELECT * FROM tblTicket INNER JOIN tblAssign ON tblTicket.TickNo=tblAssign.TicketNo WHERE tblAssign.AssignTo='{$_SESSION['username']}'");
while($Ticket = mssql_fetch_array($selectTicketsQuery)){
$Tickets[] = $Ticket;
}
$Assign = mssql_query("Select * from MISPIC");
while($AssignOption = mssql_fetch_assoc($Assign)){
$AssignOptions[] = $AssignOption;
}
?>
<html>
<head>
<title>Ticket Support</title>
</head>
<body>
<p>Welcome <?php echo $_SESSION['username']; ?>!</p>
<table border='1'>
<tr>
<th>Ticket</th>
<th>User Name</th>
<th>Date</th>
<th>Time</th>
<th>Category</th>
<th>Transfer JO</th>
</tr>
<?php
foreach($Tickets as $Ticket){
echo '<tr>';
echo '<td><a href="Ticketmanage.php?id=', $Ticket['TickNo'], '">', $Ticket['TickNo'], '</a></td>';
echo '<td>', $Ticket['UserName'], '</td>';
echo '<td>', $Ticket['DateCreate'], '</td>';
echo '<td>', $Ticket['TimeCreate'], '</td>';
echo '<td>', $Ticket['Category'], ' (', $Ticket['Subcat'], ')</td>';
echo '<td>';
echo '<form action="Transfer.php" method="get">';
echo '<input type="hidden" name="TicketNo" value="', $Ticket['TickNo'], '" />';
echo '<select name="TransferOption" onChange="form.submit()">';
echo '<option value="0">Please Select</option>';
foreach($TransferOptions as $TransferOption){
echo '<option value="', $TransferOption['MISPIC'], '">', $TransferOption['MISPIC'], '</option>';
}
echo '</select>';
echo '</form>';
echo '</td>';
echo '</tr>';
}
?>
</table>
<p><a href='Support.php'>Back</a></p>
</body>
</html><?
}else{ //not logged in
header('location: login.php');
}
It should work fine, and when the form is submitted via your chosen method, it will go to Transfer.php with the ticket number set as $_POST[‘TicketNo’] and the dropdown selection set as $_POST[‘TransferOption’]. $_GET shouldn’t really be used for pages which require modification processing, only selection processing. That’s upto you though, you can change it by changing the form method.