An7hony Posted August 20, 2010 Share Posted August 20, 2010 how would i get checkboxes to work. I have tried: $JobCategories = ($_GET['JobCategories[]']) ? $_GET['JobCategories[]'] : $_POST['JobCategories[]']; html looks like: <li><input name="JobCategories[]" type="checkbox" value="Admin" /> Admin</li> <li><input name="JoCategories[]" type="checkbox" value="Campaigning" /> Campaigning</li> Link to comment https://forums.phpfreaks.com/topic/211284-checkboxes/ Share on other sites More sharing options...
abdfahim Posted August 20, 2010 Share Posted August 20, 2010 what do you really want? If your intention is both category can be selected, and you want to store them in an array, use somthing like if(!empty($_GET['JobCategories'])) foreach($_GET['JobCategories'] as $x){ $JobCategories[] = $x; } If your intention is to select any of the category, use radio button instead Link to comment https://forums.phpfreaks.com/topic/211284-checkboxes/#findComment-1101650 Share on other sites More sharing options...
mdarling Posted August 20, 2010 Share Posted August 20, 2010 i would use javascript/jquery to pull the value(s) you need from the checkboxes. Link to comment https://forums.phpfreaks.com/topic/211284-checkboxes/#findComment-1101670 Share on other sites More sharing options...
An7hony Posted August 20, 2010 Author Share Posted August 20, 2010 that seems to be working. Although how do i pull the results i.e $message = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head></head> <body> <table> <tr><td>Categories</td><td>' . $JobCategories . '</td></tr> <tr><td>Company</td><td>' . $company . '</td></tr> <tr><td>Title</td><td>' . $title . '</td></tr> <tr><td>First Name</td><td>' . $firstname . '</td></tr> If i put $JobCategories[] into this it throws me an error Link to comment https://forums.phpfreaks.com/topic/211284-checkboxes/#findComment-1101678 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.