0

Hi! Im planning to make the entries of the Ticket # links to view the ticket information. But how do i pass the value of the clicked ticket# to the next page? thanks in advance!

<?php
session_start();
	if(!session_is_registered(myusername)){
		header("Location:main_login.php");
 	}
?>

<html>
<head>
<title>Employee</title>

<style type="text/css">
<!--
.tableContent {
    font-family:Euphemia;
    font-size: 13px;
    font-style: normal;
    color: #000;
}
.tableHead2 {	
    font-family: "Myriad Pro Light", "Myriad Pro";
	font-size: 14px;
	font-style: normal;
	font-weight: bold;
	color: #FFF;
}
-->
</style>

</head>


<body>
<tr>

</br>
  <table width="926" height="25" border="0"  style="text-align: center; font-weight: normal; border-collapse:collapse; border:1px solid #346198" cellpadding="2" cellspacing="2" id="myTable">
    <tr class="tableHead2">
      <td width="95" height="20" bgcolor="#346198"><div align="center">Ticket #</div></td>
      <td width="73" bgcolor="#346198"><div align="center">Asset ID</div></td>
      <td width="152" bgcolor="#346198"><div align="center">User</div></td>
      <td width="149" bgcolor="#346198"><div align="center">Location</div></td>
      <td width="95" bgcolor="#346198"><div align="center">Date Reported</div></td>
      <td width="77" bgcolor="#346198"><div align="center">Priority</div></td>
      <td width="78" bgcolor="#346198"><div align="center">Days Open</div></td>
      <td width="155" bgcolor="#346198"><div align="center">Requires Action Of</div></td>
    </tr>
     <?php
			include "..\configdb.php";
			include "..\opendb.php";
			
			$userId = $_SESSION['userId'];
			
			//GET ticket number
			$result = mysql_query("SELECT _ticketNum, _assets_id
								  FROM  trouble_ticket
								  WHERE _user_accounts_id='$userId' 
								  AND _ticketStatus='New' OR _ticketStatus='Open'");
			if(!$result) {
				echo 'Could not run query: ' . mysql_error();
				exit;
			}
			while($row=mysql_fetch_array($result))
			{
				$i;
				echo "<tr align='center' class='tableContent'>";   
				echo "<td>";
				if(strcmp($row['_ticketStatus'],'New'))
				{echo "<font color='#FF0000'> NEW </font>";}
				echo $row['_ticketNum'];
				echo "</td>";
				
						//GET asset control number
						$idAsset = $row['_assets_id'];
						$result1 = mysql_query("SELECT _controlNum
										  FROM  assets
										  WHERE _id='$idAsset'");
						while($row=mysql_fetch_array($result1))
						{
							$i;
							echo "<td>";
							echo $row['_controlNum'];
							echo "</td>";
							$controlNumber = $row['_controlNum'];
							$i++;
						}
						//GET user's name
						$result2 = mysql_query("SELECT _firstName, _lastName
									  FROM user_accounts
									  WHERE _id = '$userId'");
						while($row=mysql_fetch_array($result2))
						{
							$i;
							echo "<td>";
							echo $row['_firstName']." ".$row['_lastName'];
							echo "</td>";
							$i++;
						}	// end while loop
						//GET branch
						$result3 = mysql_query("SELECT _branchName 
											  FROM branch 
											  WHERE _id = (SELECT _branch_id FROM user_accounts WHERE _id='$userId')");
						while($row=mysql_fetch_array($result3))
						{
							$i;
							echo "<td>";
							echo $row['_branchName'];
							echo "</td>";
							$i++;
						}	// end while loop
				
						//GET date, priority, days open, ticket stat
						$result4= mysql_query("SELECT _dateReported, _priority, _daysOpen, _ticketStatus
											  FROM  trouble_ticket
											  WHERE _user_accounts_id='$userId' 
											  AND _ticketStatus='New' OR _ticketStatus='Open'");
						if($row=mysql_fetch_array($result4))
						{	
							echo "<td>";
							echo $row['_dateReported'];
							echo "</td>";
							echo "<td>";
							echo $row['_priority'];
							echo "</td>";
							echo "<td>";
							echo $row['_daysOpen'];
							echo "</td>";
							
							$stat = $row['_ticketStatus'];
							if(!strcmp($stat,"New"))
							{
								echo "<td>";
								echo "Technician";
								echo "</td>";
							}
						}
							
				
				echo "</tr>";
				$i++;
			}	// end while loop
      include "..\closedb.php";
	  ?>
  </table>
  </td>
  </tr>
  <tr>
    <td align="right">&nbsp;</td>
</body>
</html>

Edited by wish02: n/a

3
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by ayesha789
0

If you are dealing with a single record, ticket #, link, etc.

<a href="http://mysite.com/view_ticket.php?id=<?php echo $row['_ticketNum']; ?>">Click Here</a>

On the next page (view_ticket.php)

$ticket_id = $_GET['id'];

If your are dealing with multiple ticket #'s and hyperlinks at the same time the process would be the same except it will be necessary to create your hyperlink from within the same loop that contains the ticket #.

Edited by CFROG: n/a

0
echo '<a href="itheadCMAssign_New_Ticket.php?id="'.echo $row['_ticketNum'];.'"">'.$row['_ticketNum'].'</a>';

Parse error: syntax error, unexpected T_ECHO in C:\xampp\htdocs\joycee\ithead\itheadCM_New_Tickets.php on line 62

0

i did this in the first page

$i;
                $ticketNum = $row['_ticketNum'];
				echo "<tr align='center' class='tableContent'>";
				echo "<td>";
                echo "<input type='radio' name='ticketNum' value='$ticketNum' />";
                echo "</td><td>";
				$ticket = $row['_ticketNum'];
				echo '<a href="itheadCMAssign_New_Ticket.php?id=$ticket">'.$row['_ticketNum'].'</a>';
				echo "</td>";

and this one on the next page

$ticketNum = $_GET['id'];
			$result = mysql_query("SELECT _assets_id, _user_accounts_id
								  FROM  trouble_ticket
								  WHERE _ticketNum ='$ticketNum'");

but it shows no results. it should show me the details but nothing appears on the screen

Edited by wish02: n/a

0

does the iframe affect this problem? the url doesn't change, it is always the url of the main page that is shown in the address bar.

0
echo '<a href="itheadCMAssign_New_Ticket.php?id="'. $row['_ticketNum'];.'"">'.$row['_ticketNum'].'</a>';
//removed the second echo

There is a real good chance that iframe is the problem there, sorry I can't give you a definite answer on that one. I never use iframes for anything. IMHO Ajax is the better way to go.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.