I am trying to use a jquery dialog box as a sign up form on a project I am working on, basically I am envisioning the dialog box functioning similar to an Iframe. I want the user to be able to enter their information into the form, the information in the form captured by the next page and entered into our database, then change the content of the dialog box to let the user know they were successfully entered into the database or something went wrong and they need to try again.
Is this possible and if so can anyone point me in the direction of an online tutorial?
Any help would be greatly appreciated.
This is incredibly broad, but here is how I’d handle such a situation.
First, some setup. Pages and their purpose
Form Page – Get information from a user
Data Page – Validation,disinfect user input. On successful validation and db insert, alert “Success” on failure of either alert “Failure”
On your form page you don’t need to do anything special.
On your Data page make 2 flags
Set them to true when they succeed
Then add
We are just printing out the javascript to do the alert box. You could replace that with any legal javascript. Since PHP gets done server side, all the javascript you generate with it will be there for the browser to intepret AFTER it gets your page.
Update: Some advice:
If you want to use javascript to popup an alert box, accept input, check a database for that things existance, and then reply with a yes or no, you are going to need to employ a lot of tools. To do that I would create a RESTful API (using slim and redbeanphp is my favorite) and then use ajax to send a request for a json response.
If you want to use php to modify the value of an alert box/dictate WHEN to alert: my example is a good starting place.
jQuery is not javascript. Javascript is the language that powers all the awesome cool things that jQuery can do… which is not to say that jQuery doesn’t have a language of its own (like the multiple uses of language?)