Wrox Programmer Forums
|
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 26th, 2004, 10:40 PM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple Checkboxes Error

I'm new to PHP, but have been reading the message boards, so I'm a bit familiar with what's going on. However, I am having a problem with something that is probably really simple to fix.

I've created a form with multiple checkboxes (total of 3). If all the boxes are selected, there's NO problem. Now, if I were to choose only 2 checkboxes and leave the third blank and submit the form I get the following error:

Notice: Unidefined index: choice3 in C:\Inetpub\ftproot\development\php_testing\chapter 3\multipleChecks.php on line 11

Now I now the other to choices are passed because their values are displayed.

The weird thing is that I have also tried this example on my Mac, and it does exactly what it's supposed to do... display the values of the checkboxes that were selected and not display anything if not selected. My other box is a PC running Windows 2000 Pro.

Before I forget... I have used $_GET['variableName'] to retreave the values passed to my php page, so I know it's not that.

EXACT CODE USED minus HTML tags:

<?php
echo $_GET['choice1'];
echo $_GET['choice2'];
echo $_GET['choice3'];
?>

Any ideas why I'm getting this error when I know I shouldn't be getting it?

 
Old May 27th, 2004, 02:43 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

How about using

echo (isset($_GET['choice1'])) ? $_GET['choice1'] : '';

Instead of what you're using.

If this doesn't work, let us know what your querystring looks like.

HTH,

Snib

<><





Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Checkboxes With same name how to make t kcs_chandra ASP.NET 1.0 and 1.1 Basics 1 October 29th, 2004 09:03 AM
multiple checkboxes with same name click events kcs_chandra Classic ASP Databases 3 October 24th, 2004 08:09 AM
multiple checkboxes with same name how to checkAll kcs_chandra ASP.NET 1.0 and 1.1 Professional 1 October 23rd, 2004 08:53 AM
multiple dynamic checkboxes mlog Classic ASP Basics 0 February 14th, 2004 04:49 AM
Cannot get multiple delete using checkboxes workin gmizzell Classic ASP Databases 0 July 13th, 2003 04:22 PM





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