0

okay...seem to be experiencing some problem here....in my pc, the web application is running perfectly....but when i run it from my handheld, its showing error...

this is my code

<?php
session_start();                                        //starting session
$host="localhost";      // Host name
$username="";           // Mysql username
$password="";           // Mysql password
$db_name="test";        // Database name
$tbl_name="test3";      // Table name
$customerno=$_POST['customerno'];   
$_SESSION['customer_no']=$customerno;                         <--------error is here

$dbh1=mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die(mysql_error());

$result = mysql_query("SELECT DISTINCT invoice_no FROM $tbl_name where customer_no='$customerno' and status='Unscanned'");
?>

<title>Shipping Verification System</title>
<link rel="stylesheet" href="web.css" type="text/css" media="handheld" />
<FORM method="post" name="form">
<h1>Enter your Invoice Number</h1>            <!--Creating a form with actions-->
<table>
<tr>
<td>Invoice No. :</td>
<td>
<select name="invoiceno">
<?php
//for each row we get from mysql, echo a form input
while ($row = mysql_fetch_array($result)) {
echo "<option>$row[invoice_no]</option>\n";
}
?>
</select></td>
</tr>
</table>
<input type="submit" name="submit" value="Back" onclick="form.action='customercode.php';"></input>    
<input type="submit" name="submit" value="Submit" onclick="form.action='shipmentchecker.php';"></input>       
</FORM>

shipmentchecker.php

<?php
session_start();                                        //starting session
$host="localhost";      // Host name
$username="";           // Mysql username
$password="";           // Mysql password
$db_name="test";        // Database name
$tbl_name="test3";      // Table name
$tbl_name1="scan";      // Table name
$invoiceno=$_POST['invoiceno'];
$_SESSION['invoice_no']=$invoiceno;
$dbh1=mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die(mysql_error());
$sql="SELECT * FROM $tbl_name WHERE invoice_no = '$invoiceno'" ;            //the sql query
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);
$sql1="SELECT * FROM $tbl_name1 WHERE invoice_no = '$invoiceno'" ;          //the sql query
$result1 = mysql_query($sql1) or die(mysql_error());
$row1 = mysql_num_rows($result1);

if($row1>0)
{
    echo "Shipment exists";
    header("refresh:1;url=checker.php" );
}
else
{
    echo "New shipment found";
    header("refresh:1;url=display.php" );
}

?>

checker.php

<?php
session_start();                                        //starting session
$host="localhost";      // Host name
$username="";           // Mysql username
$password="";           // Mysql password
$db_name="test";        // Database name
$tbl_name="test3";      // Table name
$tbl_name2="scan";
$db_name1="test1";      // Database name
$tbl_name1="test2";     // Table name

// Connect to server and select database.
$dbh1=mysql_connect("$host", "$username", "$password")or die("cannot connect");
$dbh2=mysql_connect("$host", "$username", "$password",true)or die("cannot connect");

mysql_select_db("$db_name", $dbh1)or die(mysql_error());
mysql_select_db("$db_name1", $dbh2)or die(mysql_error());

$invoiceno=$_SESSION['invoice_no'];                         // session invoice no. <---------error is here

okay....i have already marked the error spot....now, the first time i run there is no problem, after entering the invoice_no i'm geting a promp saying, undefine index invoice_no and the same error for customer_no...(i'm using wifi to communicate to the server )

Edited by gopi17: errror

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Echo89
0

I'm not sure whether this will work, but on line 19 you have this:

<FORM method="post" name="form">

try changing the Submit and Back buttons so they do not POST the data. Change line 19 to this:

<FORM method="post" name="form" action="shipmentchecker.php">

Also you could try sqeezing all of the files into one, Using a switch/get system:

<?php

$page = (isset($_GET['page']) && !empty($_GET['page'])) ? $_GET['page'] : 'error';

switch($page)
{
    case 'other':

    //other page (example.php?page=other)

    break;


    default:

    //home page (example.php)

    break;
}

?>

Edited by Echo89: Changed code

This topic has been dead for over six months. 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.