[GRLUG] PHP question ... was Client/Server Database app question

Chris Lamrock clamrock at nmtdie.com
Thu Feb 2 10:24:07 EST 2006


Hmm  Maybe this will help...

Here is the code to the "main" program customers.php...


What I would LIKE to do is when I hit the "FIND" button (at the bottom of
the included code) I would like it send the user to the separate program -
search.php.

I already have search.php returning the user to customers.php.


Does this help any?


<---------------------------------------------------------------------------
>
<html>
<body>

<div align="center">Proquote V 3.0
<font size="-1"><div align="center">Customer Database</font>
<br><br>
<?
$id=1;
if (isset($place)){$id=$place;};
if (isset($submit)){
if ($submit == "Next") { $id=$id+1;}
if ($submit == "Previous") { $id=$id-1;}
if ($id < 1) {$id=1;}
}
?>
<?php
$db = mysql_connect("localhost", "user","password");
mysql_select_db("proquote",$db);
$result = mysql_query("SELECT * FROM customers where customer_id=$id",$db);

if ($myrow = mysql_fetch_array($result)) {

  echo "<table border=1>\n";

    printf("<tr><td>Customer Id</td><td>%s</tr>\n", $myrow["customer_id"]);
    printf("<tr><td>Company</td><td>%s</tr>\n", $myrow["company"]);
    printf("<tr><td>Address</td><td>%s</tr>\n", $myrow["address"]);
    printf("<tr><td>Address_2</td><td>%s</tr>\n", $myrow["address_2"]);
    printf("<tr><td>City</td><td>%s</tr>\n", $myrow["city"]);
    printf("<tr><td>State</td><td>%s</tr>\n", $myrow["state"]);
    printf("<td>Zip</td><td>%s\n", $myrow["zip"]);
    printf("<tr><td>Phone</td><td>%s</tr>\n", $myrow["phone"]);
    printf("<tr><td>Fax</td><td>%s</tr>\n", $myrow["fax"]);
    printf("<tr><td>Contact</td><td>%s</tr>\n", $myrow["contact"]);
    printf("<tr><td>Email Address</td><td>%s</tr>\n", $myrow["email"]);

  echo "</table>\n";
}

?>
<p /><form>
<br><br>
<input type="submit" name="submit" value="Previous" />
<input type="submit" name="submit" value="Next" />
<input type="submit" name="submit" value="Find" />
<input type="submit" name="submit" value="Add" />
<input type="submit" name="submit" value="Edit" />
<input type="submit" name="submit" value="Delete" />
<input type="submit" name="submit" value="Close" />
<input type="hidden" name="place" value="<? echo "$id"; ?>" />
</form>
</body>
</html>
<------------------------------------------------------------------------>




More information about the grlug mailing list