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

Chris Lamrock clamrock at nmtdie.com
Thu Feb 2 11:13:37 EST 2006


You know...

That does actually work!  :/

Thanks Dennis!

Now I think I just have to put the buttons in some sort of table so they are
lined up - after adding a new form in there the find went to a separate
line...

Thanks Again!

-----Original Message-----
From: grlug-bounces at grandrapids-lug.org
[mailto:grlug-bounces at grandrapids-lug.org]On Behalf Of Kaminski Dennis J
Sent: Thursday, February 02, 2006 10:51 AM
To: GRLUG general mailing list
Subject: Re: [GRLUG] PHP question ... was Client/Server Database app
question


Wouldn't you just have to put the FIND button in a different form?

Dennis J Kaminski




-----Original Message-----
From: grlug-bounces at grandrapids-lug.org
[mailto:grlug-bounces at grandrapids-lug.org] On Behalf Of Chris Lamrock
Sent: Thursday, February 02, 2006 10:40 AM
To: GRLUG general mailing list
Subject: Re: [GRLUG] PHP question ... was Client/Server Database app
question



Ok - I understand changing the form tag will re-route the user to the
search.php - but then it won't submit to itself for the other buttons
correct?

Also instead of submitting to itself what do recommend?  What could I
google for to find an example?

Thanks!


-----Original Message-----
From: grlug-bounces at grandrapids-lug.org
[mailto:grlug-bounces at grandrapids-lug.org]On Behalf Of Topher
Sent: Thursday, February 02, 2006 10:29 AM
To: GRLUG general mailing list
Subject: Re: [GRLUG] PHP question ... was Client/Server Database app
question


> 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?

Sure, it looks like this current script is submitting to itself.  I
personally don't prefer that method for a variety of reasons, but it's
not uncommon.  If you want it to instead go to search.php, change your
form tag to be like this

<form action="/path/to/search.php" method="post">

You can change the method to "get" if you want the variables to stay in
the URL (good for bookmarking results).

Also, I'd suggest moving your database connect info to a seperate file,
and including it.  Then you can let people see your code whenever
without having to remember to remove your stuff each time.

include($_SERVER['DOCUMENT_ROOT'] . "/path/to/dbconnect.inc.php");

>
>
>
<-----------------------------------------------------------------------
----
>>
> <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>
>
<-----------------------------------------------------------------------
->
>
>
> _______________________________________________
> grlug mailing list
> grlug at grandrapids-lug.org
> http://grlug.org/mailman/listinfo/grlug
>

Topher
Manager of Internet Services
Cornerstone University Radio

------
perl -e 'print join "", (map(chr,(shift =~ /\d{3}/g))), "\n"' \
105032119105115104032105032107110101119032112101114108
_______________________________________________
grlug mailing list
grlug at grandrapids-lug.org
http://grlug.org/mailman/listinfo/grlug




_______________________________________________
grlug mailing list
grlug at grandrapids-lug.org
http://grlug.org/mailman/listinfo/grlug
_______________________________________________
grlug mailing list
grlug at grandrapids-lug.org
http://grlug.org/mailman/listinfo/grlug

!DSPAM:43e22bb2143651301467142!







More information about the grlug mailing list