Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 24th, 2007, 01:03 PM
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to interpret checkboxes on server-side forms

Hi

I'm a beginer coder with javascript and PHP

I am coding a (very) basic online-store:

http://www.macs.hw.ac.uk/~avm1/Net&C...erch/shop.html

I am currently in the process of writing the PHP code to deal with the information on the form when it is submitted, and have hit a brick wall.

As you can see I only have three 'products' on this website. I am conciously not allowing the user to buy these products in varying quantities, rather forcing the user to select which products they would like via the checkboxes.

With the PHP code I am trying to design an order confirmation page, which will display the user's contact details and order details and ask them to confirm that they are correct.

I have got the textbox values working on the server side, but I am struggling with the checkboxes.

I want to be able to check which checkboxes are checked, and display the relevant product and price on the confirmation page.

For example, if the user submits the form with the Tshirt checkbox checked, I would like the PHP to return

Quote:
quote:Please confirm the following details are correct:

firstname surname
address
email address

Order:
Tshirt - £10
I cannot, however, figure out how to combine javascript and PHP in order to do this.

In searching, I have found similar example code, but it is much more complex than what I am trying to achieve and I cannot comprehend it.

Any help would be greatly appreciated guys

thanks in advance - Ravie

Reply With Quote
  #2 (permalink)  
Old June 6th, 2007, 05:34 AM
Authorized User
 
Join Date: Mar 2005
Location: , , India.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to pritz Send a message via Yahoo to pritz
Default

Hi ravie,

you can do one thing give the same name array something like product[] to all these product check box when you post your form in $_POSt you will be having this product[] which will save the values the one user had clicked.

ex:
<input type="checkbox" name="product[]" value="Tshirt-$10">Tshirt

hope this trick helps i have been to this problem once :-)

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Converting Client-side to Server-side Code kwilliams ASP.NET 2.0 Professional 1 November 21st, 2007 05:25 PM
How to interpret checkboxes on server-side forms Ravie Javascript How-To 0 May 24th, 2007 01:10 PM
Checkboxes and continuous forms mdProgrammer Access VBA 4 August 3rd, 2006 09:47 AM
Firing server side events at client side codes mehdi62b ASP.NET 1.0 and 1.1 Basics 6 May 18th, 2005 09:11 AM
Accessing Server Side Data on Client Side steve456 Classic ASP Professional 3 October 15th, 2003 02:33 PM



All times are GMT -4. The time now is 02:50 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.