Jump to content

Archived

This topic is now archived and is closed to further replies.

jamesnkk

How to query a database before Posting

Recommended Posts

Hi, I am a newbies here, just started learning PHP, Could not find an answer to my requirement, hope some experts can offer help.

Here I have an entry from for entering Part numbers, description, price and qty so on...
So when a user enter a part number, I would want to immediate check if this part numbers already exist before the user click the submit button to post.

Share this post


Link to post
Share on other sites
That can only be done via Javascript and AJAX.

Ken

Share this post


Link to post
Share on other sites
[!--quoteo(post=355599:date=Mar 17 2006, 01:55 AM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Mar 17 2006, 01:55 AM) [snapback]355599[/snapback][/div][div class=\'quotemain\'][!--quotec--]
That can only be done via Javascript and AJAX.

Ken
[/quote]

Ken, Thank for your fast response, do you mean I can only use javascript to query the table ?, and not possible in PHP ?

Share this post


Link to post
Share on other sites
You can do this both ways.

1) You can have them enter a part number and give them a button. The button submits the form and either takes them to a second form where they fill in additional information about the part to be submitted for insertion, or it takes them to a page that says the part already exists.

2) Same as above, but you use AJAX to return the results. If you don't understand what AJAX is, check out www.ajaxfreaks.com (a sister site of phpfreaks). It's a javascript call that can run a PHP script that will return data to a specified area of your page without reloading the page.

I'd personally go with AJAX, but it requires the user to have Javascript enabled to use the functionality of the site.

Share this post


Link to post
Share on other sites
[!--quoteo(post=355614:date=Mar 17 2006, 02:33 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 17 2006, 02:33 AM) [snapback]355614[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You can do this both ways.

1) You can have them enter a part number and give them a button. The button submits the form and either takes them to a second form where they fill in additional information about the part to be submitted for insertion, or it takes them to a page that says the part already exists.

2) Same as above, but you use AJAX to return the results. If you don't understand what AJAX is, check out www.ajaxfreaks.com (a sister site of phpfreaks). It's a javascript call that can run a PHP script that will return data to a specified area of your page without reloading the page.

I'd personally go with AJAX, but it requires the user to have Javascript enabled to use the functionality of the site.
[/quote]
Thank for the advises, well consider

Share this post


Link to post
Share on other sites

×

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.