p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: problem with checkboxes in chap3


Message #1 by "nunu" <nunu_tok@h...> on Sun, 20 Oct 2002 17:33:51
If i didn't check all the boxes, it appear messages :
Haggis

Notice: Undefined variable: Choice2 in c:\inetpub\wwwroot\checkboxes.php on
line 6

Locust
How can I handle this problem ?
pls help..


html.
<HTML>
<HEAD></HEAD>
<BODY>
<FORM METHOD=POST ACTION="checkboxes.php">
Have you ever eaten haggis before?
<INPUT NAME="Choice1" TYPE="Checkbox" VALUE="Haggis">
<BR>
Have you ever eaten snails before?
<INPUT NAME="Choice2" TYPE="Checkbox" VALUE="Snails">
<BR>
Have you ever eaten locusts before?
<INPUT NAME="Choice3" TYPE="Checkbox" VALUE="Locusts">
<BR>
<BR>
<INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>

php 

<HTML>
<HEAD></HEAD>
<BODY>
<?php
echo "$Choice1<BR>";
echo "$Choice2<BR>";
echo "$Choice3<BR>";
?>
</BODY>
</HTML>
Message #2 by tekronx@a... on Mon, 21 Oct 2002 01:53:52
Once again many people have the same problem with the same answer which I 
had the same problem with the same answer ask yourself this

Did you go into the php.ini and set register_globals to on
it should look like this

;
; You should do your best to write your scripts so that they do not 
require
; register_globals to be on;  Using form variables as globals can easily 
lead
; to possible security problems, if the code is not very well thought of.
register_globals = on

it is under this section

;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;
;

Hope this works let me know :)

  Return to Index