Jump to content

checkboxes


An7hony

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.