NYCPHP Meetup

NYPHP.org

[nycphp-talk] small problem in ajax

Brent Baisley brenttech at gmail.com
Wed Aug 19 09:48:02 EDT 2009


On Wed, Aug 19, 2009 at 1:00 AM, Mangesh Sathe<mangesh at ascellent.co.in> wrote:
> hello everyone,
>
>  This is Mangesh Sathe.
>
>    I am facin'  small problem in ajax.
>
> I have created one form which contains entries like his/her
>    name,address,country, state ,bank name(dropdown list) , birth date etc...
> when i submit this form all the above data goes to databse correctly ...
>
>  now if his/her bank name is not in the dropdown list , then he enters his
> bank name in textbox & clicks on first button
>   so insted of submitting entire forn ,i want to insert only bank name in
> database using ajax.
>  ( i am sending bank name to .js file & then call .php file
>
> Buttons in the form,
>     first one is for adding bank name in database,if it does'nt exist in
> Dropdown list
>         (Drop downlist---Textbox----Button1)
>     second one is to submit entire form.
>
> Reply plz

You should keep it as a single submission for simplicity for the user.
I would have an "Other" as the last item in the drop down list, which
would reveal a field to enter a bank name in. Select a bank name would
hide the field. Then on the server side you check if the "Other" bank
option was selected, then enter the "Other" bank name in your
database.
It keeps it to a single form submission with a single button.



More information about the talk mailing list