Jump to content

[SOLVED] Form returning empty but no errors??


cmaclennan

Recommended Posts

Hey All,

 

hoping I just need another set of eyes, but I have a search form that once submitted is supposed to return the values from a MySQL database, but i am getting nothing showing and no errors of any kind.

 

Any Help is appreciated.

 

<?php # Script 8.6.2 - order_search_field.php

include ('style.htm');
$page_title = 'Find Ticket';

// Page header.
echo '<div id="title">Find Ticket</div>';

// Check if the form has been submitted.
if (isset($_GET['submitted'])) {

$se = $_REQUEST['search'] ;

	// Register the user in the database.
	require_once ('mysql_connect.php'); // Connect to the db.

	// Make the query.
	$query = "SELECT * FROM tickets WHERE ticket_id LIKE '$se' OR company LIKE '$se'";		
	$result = @mysql_query ($query); // Run the query.
	if ($result) { // If it ran OK.

				// Print a message.
		echo '<br>Your entry has been found.</br><br/>';	

	while ($row = mysql_fetch_array($result)){   
		echo '<table width="650px" border="0" cellspacing="5" cellpadding="0">
  <tr>
    <td colspan="4"><img src="images/powerlogo.gif" width="300" height="39" alt="PowerCart" /></td>
  </tr>
  <tr>
    <td colspan="4"></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Ticket Details</strong></td>
    <td>Ticket Id: </td>
    <td>'; echo $row['ticket_id']; echo '</td>
  </tr>
  <tr>
    <td>Opened By:</td>
    <td>'; echo $row['name']; echo '</td>
    <td>Date:</td>
    <td>'; echo $row['date']; echo '</td>
  </tr>
  <tr>
    <td>Email:</td>
    <td>'; echo $row['email']; echo '</td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td>Contact:</td>
    <td>'; echo $row['contact']; echo '</td>
    <td>Contact Email:</td>
    <td>'; echo $row['c_email']; echo '</td>
  </tr>
  <tr>
    <td>Phone:</td>
    <td>'; echo $row['phone']; echo '</td>
    <td>Ext:</td>
    <td>'; echo $row['ext']; echo '</td>
  </tr>
  <tr>
    <td>Store ID:</td>
    <td>'; echo $row['store_id']; echo '</td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td>Address:</td>
    <td colspan="3">'; echo $row['address']; echo '</td>
  </tr>
  <tr>
    <td colspan="4"> </td>
  </tr>
  <tr>
    <td>Ticket Status:</td>
    <td>'; echo $row['status']; echo '</td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td>Priority:</td>
    <td>'; echo $row['priority']; echo '</td>
    <td>Under Warranty:</td>
    <td>'; echo $row['warranty']; echo '</td>
  </tr>
  <tr>
    <td>Cart Serial:</td>
    <td>'; echo $row['serial']; echo '</td>
    <td>Original ship Date:</td>
    <td>'; echo $row['o_date']; echo '</td>
  </tr>
  <tr>
    <td>Issue:</td>
    <td>'; echo $row['issue']; echo '</td>
    <td>Technician Sent:</td>
    <td>'; echo $row['tech']; echo '</td>
  </tr>
  <tr>
    <td colspan="4"> </td>
  </tr>
  <tr>
    <td>Notes/Details:</td>
    <td colspan="3">'; echo $row['notes']; echo '</td>
  </tr>
</table>';
		} 


		// Include the footer and quit the script (to not show the form).

		exit();

	} else { // If it did not run OK.
		echo '<h1 id="mainhead">System Error</h1>
		<p class="error">Your entry could not be found due to a system error. We apologize for any inconvenience. Please advise  the System Administrator</p>'; // Public message.
		echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; // Debugging message.

		exit();
	}

	mysql_close(); // Close the database connection.

} 

?>

Link to comment
Share on other sites

Is $_GET['submitted'] set?

 

change:

 

if (isset($_GET['submitted'])) {

 

 

 

 

to:

 

 

 

if (isset($_GET['submitted'])) {

echo "yes it is";exit;

 

 

 

 

to see if it is (then remove the extra bit)

 

 

 

 

 

Good to know what you do get from running the script. Anything shown on screen at all?

Link to comment
Share on other sites

do you know what the @ symbol does?

$result = @mysql_query ($query); // Run the query

 

it suppresses errors, so that is probably why you aren't getting an error. plus, you should do this

$result = mysql_query ($query) or die(mysql_error()); // Run the query

 

to see what errors mysql might be spitting back at you. It seems like your query is failing

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.