Forum Moderators: coopster

Message Too Old, No Replies

write to a page dependant on tick box value

         

Colinuk

6:52 pm on Apr 23, 2004 (gmt 0)

10+ Year Member



Hi all,

what im trying to do is write something to a page dependant on what box's are ticked

i know how to write to a page using fopen & fwrite

but i dont know how to make it dependant on the tick boxes :\

any help/examples would be appreciated :)

thanks
Colinuk

Birdman

9:49 pm on Apr 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure, I'll give an example. Basically, you need to do a switch() or a series of if() statements to determine which box was ticked.

<input type="checkbox" name="option" value="opt1" />
<input type="checkbox" name="option" value="opt2" />
<input type="checkbox" name="option" value="opt3" />

switch($_POST["option"]){
case "opt1": $write_to_file = "";
case "opt1": $write_to_file = "";
case "opt1": $write_to_file = "";
default: $write_to_file = "nothing was checked";
}

Colinuk

2:32 pm on Apr 24, 2004 (gmt 0)

10+ Year Member



Thanks Birdman!

i thought about using a series of if/else statments without the switch too, but didnt know how to get the value from the tick boxs.

thanks again :)

Colinuk