Click to See Complete Forum and Search --> : Help: How-to create a basic PHP order/email form with AJAX


Van Helsing
10-21-2008, 08:40 AM
Hey all,

I currently have a project on my hands that requires me to use technologies / languages I'm not quite proficient in yet.

You can see how my site looks here:
http://www.ve-designs.net/NXEA/index.php

The basic principle is, there are a bunch of items on a page, in grid view. Next to each item is a text field in which the user can specify how many of each item they would like.
Under this field is an 'Add' button, which will take the item's name and their quantity into a form on the right hand side of the page.

This form on the right constitutes of basically an email contact form. It has name, mobile, email fields etc.

What the AJAX (or even just JavaScript, whatever you would like to refer it is) does, is for every item added a new row of text fields appears under the existing form.

The two text fields are: The Name of the item x quantity

There is a remove button at the end of each row to delete that row.


The same basic functionality can be found on this page:
http://www.papajohns.co.uk/Stores/rayleigh/pizzas.aspx


Hopefully my explanations have been thorough enough,

I'm not looking for a full write of code (although I wouldn't complain ;) ), just helpful pointers and tips of what to do,

Thanks for your help! :)

jim_keller
10-27-2008, 11:36 AM
This sounds like a perfect time to use JQuery (http://jquery.com/). JQuery allows you to easily loop through dom elements on your page, collect the data, and post it back to another url via ajax. There should be enough information in the docs - you may also want to look into the JQuery Form plugin

Van Helsing
10-27-2008, 11:43 AM
Hi there,

Thank you for your interest - but I managed to solve the problem through perseverance and some help from others, you can see the finished product here:

http://www.ve-designs.net/NXEA/index.php

I'll look into jQuery a bit more however :)