Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

querying database from web based form

Status
Not open for further replies.

ajdesigns

Technical User
Jan 26, 2001
154
0
0
GB
Could someone please explain the post & get commands. I have compiled a html form that I want to use to allow my customers to enter an order no into.I then want the form to Query my database and return the order details ie: despatched ,assembled etc back to my customers is this possible if so how.
please help
AD
 
If you use GET method you have to look for the key=>val inside $_GET[] var. For example you wrote:

<input type=&quot;text&quot; name=&quot;num&quot; />

you will have to look for $_GET['num']

If you use a POST method you will have to look for $_POST['num']

You choose to use GET or POST when you define the form:

<form action=&quot;order.php&quot; method=&quot;post&quot;>

or

<form action=&quot;order.php&quot; method=&quot;get&quot;>

with the GET method you'll see in the address bar a thing like this:


where <val> is what you typed in the text input

but this is HTML not PHP...
 
Hi,
Like the above users said, POST and GET are not PHP commands. But, I'll bite. To expand on what they've said, you must do something like this:
(assuming <input type=&quot;text&quot; name=&quot;num&quot;> and proper validation, etc)

For:

<form method=&quot;POST&quot;>
on your processing page:

$partnum=$_POST['num'];
Your SQL statement will be
SELECT * FROM TABLE WHERE NUMBER = $partnum;

For:
<form method=&quot;GET&quot;>
on your processing page:

$partnum=$_GET['num'];
Your SQL statement will be
SELECT * FROM TABLE WHERE NUMBER = $partnum;


[cheers]
Cheers!
Laura
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top