Jump to content

checkboxes


czukoman20

Recommended Posts

          <label>
          <span class="style6">
          <input type="checkbox" name="sto" id="stocks" />
          Stocks</span></label>
          <span class="style6">
          <label>
          <input type="checkbox" name="com" id="commodities" />
          Commodities</label>
          <label>
          <input type="checkbox" name="mort" id="mortgages" />
          Mortgages</label>
          <label>
          <input type="checkbox" name="fin" id="financial planning" />
          Financial Planning</label>
          </span><span class="style5"><label></label>
          </span>
          <label></label>
          <span class="style6">
          <label>
          <input type="checkbox" name="edu" id="education" />
          Ed. on Investing</label>
          </span></p>
        <p>
          <input name="email2" type="text" id="email2" size="45" />
        </p>
        <p>
          <input name="phone" type="text" id="phone" size="45" />
          </p></td>

 

I have these checkboxes.. in my submit form.

 

I would like to know how to manipulate them so that when one is checked on, it will echo that category

 

how would i go about doing this

Link to comment
Share on other sites

ok well i did that... and now im stuck again.. cause its giving a avalue for the checked check boxes just a single word array

 

   

if(isset($_POST['button']))
{  


$req_user_info = $database->getUserInfo($req_user);

   $email2 =$_POST['email2'];
   $companyname=$_POST['companyname'];
   $realname =$_POST['realname']; 
   $last_name =$_POST['last_name'];
   $phone =$_POST['phone'];
   $market =$_POST['market']; 
foreach ($market as $marketname)
{
echo "$marketname\n";
}

$message2 = $realname." $last_name has submitted a Advertise with us form to adworld.,\n\n"
             ."This persons information is as follows\n"
		 ."----------------------------\n"
    		 ."Contact Name: $realname $last_name\n "
		 ."Company: $compname\n "
   			 ."E-mail: $email2\n "
             ."Phone: $phone\n "
		 ."This person is interested in the following categories\n"
		 ."$marketname\n"
		 ."----------------------------\n"
		 ."";	  


<input type="checkbox" name="market[]" value="Stocks" />
          Stocks</span></label>
          <span class="style6">
          <label>
          <input type="checkbox" name="market[]" value="Commodities" />
          Commodities</label>
          <label>
          <input type="checkbox" name="market[]" value="Mortgages" />
          Mortgages</label>
          <label>
          <input type="checkbox" name="market[]" value="Financial Planning" />
          Financial Planning</label>
          </span><span class="style5"><label></label>
          </span>
          <label></label>
          <span class="style6">
          <label>
          <input type="checkbox" name="market[]" value="Ed. on Investing" />
          Ed. on Investing</label>
          </span></p>

 

 

that is what i have this.. grant it the checkbox is in a form that works.. but im concentrating on the transfering the values when they are checked

 

Thanks

 

Link to comment
Share on other sites

I don't understand the code you posted at all.  Typically the idea is to organize your script thus:

 

if (the submit button has been pressed)

    abstract the form data and process it

 

otherwise (display the form)

 

The example I pointed you too explained exactly how to determine which of an unlimited number of checkboxes in a form had been checked.

 

Perhaps you need to review the article and review your code logic in light of the above.

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.