Jump to content

How to query a database before Posting


jamesnkk

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.
Link to comment
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 ?
Link to comment
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.
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.