Welcome to WebmasterWorld Guest from 50.16.126.107

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

HTML Form Checkboxes and php..

HTML form checkbox php

     

jon_mcb

4:01 pm on Mar 26, 2003 (gmt 0)

Inactive Member
Account Expired

 
 


In learning PHP while doing.. I decided to throw some troubleshooting code in my php. The script will, eventually, throw all the information from my HTML form in to a MySLQ database.. In the mean time, I threw this code in for troubleshooting purposes:

echo("" . $_POST['ContactID'] . "");
echo("<br>");
echo("" . $_POST['Company'] . "");
echo("<br>");
echo("" . $_POST['var_receive'] . "");
echo("<br>");
echo("" . $_POST['var_deploy'] . "");
echo("<br>");
echo("" . $_POST['comments'] . "");
echo("<br>");

To make sure php was passed the correct information. All variables came through correct except 'var_deploy' and 'var_receive', which were blank. These two are checkboxes. What I would like is for php to be passed each checkbox value seperated by commas.

Can someone help me out here? A guy here is trying to get me to use FrontPage... But I like my Notepad..

4:14 pm on Mar 26, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 14, 2002
posts:118
votes: 0


Bang the head of the person who's trying to get you to use frontpage against a wall repeatedly until he repents for his sins (assuming it is a him).

Anyway, checkboxes will return blank unless they are checked, in which case they return with a value of "on".

HTH

Allen

4:22 pm on Mar 26, 2003 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15756
votes: 0


you could test for it
if (!isset($_POST['var_deploy'])) {
$var_deploy = "unchecked";
}

Welcome to WebmasterWorld jon_mcb

8:49 pm on Mar 26, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 1, 2003
posts:19
votes: 0


An easy way to see what's posted by your form :
<pre>
<?php
print_r($_POST);
?>
</pre>

It can be useful with large forms and tons of data.

Jocelyn

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members