Keep the results of a radio button, checkbox and list

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Keep the results of a radio button, checkbox and list

Post by John Cartwright »

How do I keep the results of a radio button, checkbox and list.

For a checkbox what do I do..

Code: Select all

<INPUT type=checkbox value=<? echo "$_SESSION['contact_icq']"; ?> name="contact_icq">
When I do that nothing happens when the form is reloaded on submit.
danyprundus
Forum Newbie
Posts: 4
Joined: Sun Mar 28, 2004 8:10 pm

Post by danyprundus »

Try
<INPUT type=checkbox value=<? echo "$_SESSION['contact_icq']"; ?> name="contact_icq">

Code: Select all

<?php
<INPUT type=checkbox value=<? echo "$_SESSION['contact_icq']"; ?> name="contact_icq"
<?
if($_SESSION['contact_icq']) echo ' checked ' 
?>
> 

?>
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

make sure the session is set BEFORE being called
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I figured it out on my own but tahnks alot for the help :p

cheers
Post Reply