Php checkboxes

Anyone have a piece of simple php coding that gets
informatiom from a
set of checkboxes and checks to see that at least one
checkbox has been
ticked by the user?
Or isnt it that simple?
Thanks
Os

Hi Gary,
Thanks for taking the time to respond. I know you are good at
the php
stuff, wish I was too.
That looks simple enough, once it's down on paper :)
I'm going to try and integrate the examples into my existing
set up in
the next day or so and see if I get a result.
I'm gradually learning a bit more about php but I'm going
nowhere as
fast as I would like too :(
Thanks
Os
Gary White wrote:
> When a form is submitted, checkbox values are only sent
if the checkbox
> is checked. any unchecked checkboxes are treated as if
they weren't even
> there. There are at least a couple of different
approaches to validating
> that. Which would be best would depend on what it is
you're doing.
>
> Typically, when you have a group of checkboxes and you
want at least one
> of them checked, they are related in some way. If that's
the case, I'll
> usually name them the same so they'll be treated as an
array:
>
> <input type="checkbox" name="colors[]"
value="red">
> <input type="checkbox" name="colors[]"
value="green">
> <input type="checkbox" name="colors[]"
value="blue">
>
> You could then test it like this:
>
> if(isset($_POST['colors'])){
> // at least one was checked
> }else{
> // nothing was checked
> }
>
> If that isn't appropriate and you need to name them
differently, you'd
> need to test for each individual name:
>
> <input type="checkbox" name="name" value="widget">
> <input type="checkbox" name="size" value="large">
> <input type="checkbox" name="colors"
value="green">
>
> if(
> isset($_POST['name']) ||
> isset($_POST['size']) ||
> isset($_POST['color'])
> }{
> // at least one was checked
> }else{
> // nothing was checked
> }

Similar Messages

  • Flash form to PHP/database

    i'm going crazy and i hope someone can help me
    here is the script i'm trying to pass to the php page
    PHP Checkbox tutorial
    www.flashscript.biz, 2005
    stop ();
    // importing button and checkbox class
    var name_txt:mx.controls.TextInput;
    var email_txt:mx.controls.TextInput;
    var company_txt:mx.controls.TextInput;
    var newsletter:mx.controls.CheckBox;
    var submitBut:mx.controls.Button;
    var messageBox:TextField;
    // LoadVars objects
    var lv:LoadVars;
    lv = new LoadVars ();
    var lvAnswer:LoadVars;
    lvAnswer = new LoadVars ();
    // button label
    submitBut.label = "Submit";
    // we give "myCheckbox" a default value
    var myCheckbox:String;
    myCheckbox = "selected";
    // we create a listener for the checkbox to increase either
    number
    var checkListener:Object = new Object ();
    checkListener.click = function () {
    // here we let the user select
    if (newsletter.selected) {
    myCheckbox = "isSelected";
    } else {
    myCheckbox = "not selected";
    newsletter.addEventListener ("click", checkListener);
    // sending out the data
    submitBut.onRelease = function () {
    messageBox.text="Please wait.";
    lv.name_txt = name_txt;
    lv.email_txt = email_txt;
    lv.company_txt = company_txt;
    lv.myCheckbox = newsletter;
    lv.action = "send";
    lv.sendAndLoad ("includes/techinfo_signup.php", lvAnswer,
    "POST");
    // receiving the data from the php file
    lvAnswer.onLoad = function () {
    messageBox.text = this.result;
    the text field caomes back as undefined
    the php page is calling
    name_txt
    email_txt
    company_txt
    myCheckbox / newsletter
    here is the url so you can see what i'm talking about...
    http://www.lightningmedia.com/form_test.php
    any help would save me life.... thanks
    cheers
    -n8

    ok so i;ve gon back to the down a dirty way of doing this...
    http://www.lightningmedia.com/form_test.php
    (technical info tab)
    each text field has a Var: Name, email, and company
    i've used the CheckBox component
    i;ve placed the fallowing code on the submit button
    on (release) {
    if (!email.length || email.indexOf("@") == -1 ||
    email.indexOf(".") == -1) {
    EmailStatus = "Please enter a valid E-mail address";
    } else {
    loadVariablesNum("includes/techinfo_signup.php", 0, "POST");
    this.gotoAndStop(2);
    easy enough right?
    everything works fine but the CheckBox......
    i'm trying to send a 1 or 0 to the database.
    i've given the component a
    fieldname: newsletter (the same as the field in the database)
    data type: Boolean
    required: true
    Read only: false
    kind: data
    formatter:none
    encoding:none
    default value:1
    path: includes/techinfo_signup.php
    storage type: simple
    so what am i missing? i'm at a loss...
    thanks again

  • Contact form-checkbox PHP coding doesnt work

    I am a beginner to web page design so i would be grateful if you can explain to me what PHP coding i would need for 'Checkbox' and where to place it in the PHP coding below. I can submit the form to my email with all the headings and the filled in forms with checkbox Yes or No.
    Only problem i have is that part of the check box info appear right at the top of the email message rather than the 'Name', 'Tel', 'Email' etc..Another half of the checkbox appear where it suppose to be wih double heading as shown below. I would also like to remove the <br> from the email message. Can you also tell me how to change the colour for heading so its clear.
    I have marked the checkbox code in BLUE for both HTML and PHP coding below. Sorry for the long coding. Look forward to hearing from someone. Much appreciated.
    Message delivered to the email address as received:
    Rear ground extension: Yes
    Two-storey rear extension: Yes
    Two-storey side extension: No
    Loft: Yes
    New Build: Yes
    Other: Yes
    Name: Test<br>
    Email: [email protected]<br>
    Contact No: 87576as<br>
    Address1: addy1<br>
    Address2: addy2<br>
    Town: town<br>
    County: county<br>
    Postcode: post<br>
    Property Type: Cottage<br>
    Property Area: None<br>
    Message:<br>
    test msg
    My HTML coding for the form:
    <div class="contactForm">
          <form id="form1" name="form1" method="post" action="test2.php">
            <fieldset>
              <legend><strong>Personal Information</strong></legend>
              <table width="690" border="0">
                <tr>
                  <td width="340"><p>
                <label for="name" class="contactLable">Name:</label>
                <input name="name" type="text" id="name" tabindex="10" size="30" />
              </p></td>
                  <td width="340"><p>
                <label for="contact_number" class="contactLable">Contact No:</label>
                <input name="contact_number" type="text" id="contact_number" tabindex="20" size="30" />
              </p></td>
                </tr>
              </table>
              <table width="690" border="0">
                <tr>
                  <td><p>
                <span id="sprytextfield1">
                <label for="email" class="contactLable">Email:</label>
                <input name="email" type="text" id="email" tabindex="30" size="30" />
              <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span> </p></td>
                </tr>
              </table>
            </fieldset>
            <fieldset>
              <legend><strong>Project Information</strong></legend>
              <p><table width="690" border="0">
      <tr>
        <td width="340"><p>
                <label for="address1" class="contactLable">Address 1:</label>
                <input name="address1" type="text" id="address1" tabindex="40" size="30" />
              </p></td>
        <td width="340"> <p>
                <label for="address2" class="contactLable">Address 2:</label>
                <input name="address2" type="text" id="address2" tabindex="50" size="30" />
              </p></td>
      </tr>
      <tr>
        <td><p>
                <label for="town" class="contactLable">Town:</label>
                <input name="town" type="text" id="town" tabindex="60" size="30" />
              </p></td>
        <td><p>
                <label for="county" class="contactLable">County:</label>
                <input name="county" type="text" id="county" tabindex="70" size="30" />
              </p></td>
      </tr>
      <tr>
        <td><p>
                <label for="postcode" class="contactLable">Post Code:</label>
                <input name="postcode" type="text" id="postcode" tabindex="80" size="10" />
              </p></td>
        <td> </td>
      </tr>
      <tr>
        <td><p>
                <label for="propertyType" class="contactLable">Property Type:</label>
                <select name="propertyType" id="propertyType" tabindex="90">
                  <option>Please select</option>
                  <option>Detached</option>
                  <option>Semi-Detached</option>
                  <option>End of Terrace</option>
                  <option>Mid-Terrace</option>
                  <option>Flat</option>
                  <option>Bungalow</option>
                  <option>Cottage</option>
                  <option>Other</option>
                </select>
              </p></td>
        <td><p>
                <label for="propertyArea" class="contactLable">Property Area:</label>
                <select name="propertyArea" id="propertyArea" tabindex="100">
                  <option>Please select</option>
                  <option>None</option>
                  <option>Listed Building</option>
                  <option>Conservation Area</option>
                </select>
              </p></td>
      </tr>
    </table>
    </p>
           </fieldset><fieldset><legend><strong>Project Type</strong></legend>
              <table width="690">
                <tr>
                  <td width="338"><label>
                    <input name="rearExt" type="checkbox" class="contactCheckbox" id="CheckboxGroup1_0" tabindex="110" value="rearExt"/>
                  Rear ground extension</label></td>
                  <td width="340"><input name="sideExt" type="checkbox" class="contactCheckbox" id="CheckboxGroup1_1" tabindex="120" value="sideExt"/>
    Side ground extension</td>
                </tr>
                <tr>
                  <td><input name="twoStoreyRear" type="checkbox" class="contactCheckbox" id="twoStoreyRear" tabindex="130" value="twoStoreyRear"/>
    Two-storey rear extension</td>
                  <td><input name="twoStoreySide" type="checkbox" class="contactCheckbox" id="twoStoreySide" tabindex="140" value="twoStoreySide"/>
    Two-storey side extension</td>
                </tr>
                <tr>
                  <td><input name="loft" type="checkbox" class="contactCheckbox" id="loft" tabindex="150" value="loft"/>
    Loft conversion </td>
                  <td><input name="newBuild" type="checkbox" class="contactCheckbox" id="newBuild" tabindex="160" value="newBuild"/>
    New build </td>
                </tr>
                <tr>
                  <td><input name="flat" type="checkbox" class="contactCheckbox" id="flat" tabindex="170" value="flat"/>
    Flat conversion</td>
                  <td><input name="other" type="checkbox" class="contactCheckbox" id="other" tabindex="180" value="other"/>
    Other conversion</td>
                </tr>
              </table>
            </fieldset>
            <fieldset><legend><strong>Message</strong></legend>
              <p>
                <label for="message" class="contactLable">Your Message or Comments:</label>
                <textarea name="message" id="message" cols="45" rows="5" tabindex="190"></textarea>
              </p>
            </fieldset>
            <br />
            <input type="submit" name="Sumbit" id="Sumbit" value="Submit" tabindex="200" />
          </form>
        </div>
    PHP Coding to send to my email:
    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <META HTTP-EQUIV="refresh" content="0;URL=thankyou.html">
    <title>Email Form</title>
    </head>
    <body>
    <?php
      $name=addslashes($_POST['name']);
      $contact_number=addslashes($_POST['contact_number']);
      $email=addslashes($_POST['email']);
      $address1=addslashes($_POST['address1']);
      $address2=addslashes($_POST['address2']);
      $town=addslashes($_POST['town']);
      $county=addslashes($_POST['county']);
      $postcode=addslashes($_POST['postcode']);
      $propertyType=addslashes($_POST['propertyType']);
      $propertyArea=addslashes($_POST['propertyArea']);
      $rearExt=($_POST['rearExt'])?"Rear ground extension: Yes":"Rear ground extension: No";
      $sideExt=($_POST['sideExt'])?"Side ground extension: Yes":"Side ground extension: No";
      $twoStoreyRear=($_POST['twoStoreyRear'])?"Two-storey rear extension: Yes":"Two-storey rear extension: No";
      $twoStoreySide=($_POST['twoStoreySide'])?"Two-storey side extension: Yes":"Two-storey side extension: No";
      $loft=($_POST['loft'])?"Loft: Yes":"Loft: No";
      $newBuild=($_POST['newBuild'])?"New Build: Yes":"New Build: No";
      $flat=($_POST['flat'])?"Flat: Yes":"Flat: No";
      $other=($_POST['other'])?"Other: Yes":"Other: No";
      $msg.="\n$rearExt\n$wsideExt\n$twoStoreyRear\n$twoStoreySide\n$loft\n$newBuild\n$wflat\n$ other";
      $message=addslashes($_POST['message']);
    // you can specify which email you want your contact form to be emailed to here
      $toemail = "[email protected]";
      $subject = "From Website Test";
      $headers = "MIME-Version: 1.0\n"
                ."From: \"".$name."\" <".$email.">\n"
                ."Content-type: text/html; charset=iso-8859-1\n";
      $body = "Name: ".$name."<br>\n"
                ."Email: ".$email."<br>\n"
                ."Contact No: ".$contact_number."<br>\n"
                ."Address1: ".$address1."<br>\n"
                ."Address2: ".$address2."<br>\n"
                ."Town: ".$town."<br>\n"
                ."County: ".$county."<br>\n"
                ."Postcode: ".$postcode."<br>\n"
                ."Property Type: ".$propertyType."<br>\n"
                ."Property Area: ".$propertyArea."<br>\n"
                ."Rear ground extension: ".$rearExt."<br>\n"
                ."Side ground extension: ".$sideExt."<br>\n"
                ."Two-storey rear extension: ".$twoStoreyRear."<br>\n"
                ."Two-storey side extension: ".$twoStoreySide."<br>\n"
                ."Loft conversion: ".$loft."<br>\n"
                ."New build: ".$newBuild."<br>\n"
                ."Flat: ".$flat."<br>\n"
                ."Other: ".$other."<br>\n"
                ."Message:<br>\n"
                .$message;
      if (!ereg("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email))
        echo "That is not a valid email address.  Please return to the"
               ." previous page and try again.";
        exit;
        mail($toemail, $subject, $body, $msg, $headers);
        echo "Thanks for submitting your comments";
    ?>
    </body>
    </html>

    Dear David
    Thank you so much for the clear explanation. I have been using Lynda.com Dreamweaver CS5 tutorial. I found the coding for checkbox through search and added to the coding from Lynda.com tutorial.
    I made few changes to the coding by removing:
    $msg = "$rearExt<br>\r\n$sideExt<br>\r\n$twoStoreyRear<br>\r\n
              $twoStoreySide<br>\r\n$loft<br>\r\n$newBuild<br>\r\n$flat<br>\r\n$other\r\n";
    as the email message shows the results from the checkbox twice.
    I also removed the <br> from:
    $body = "Name: $name<br>\r\n
              Email: $email<br>\r\n
              Contact No: $contact_number<br>\r\n
             Other: $other\r\n
              Message:\r\n
                $message";
    I have add the result and the PHP coding you have helped to fixed for anyone needing a working PHP code containing Text Fields, Drop Down List, Checkbox and Text Area. Many thanks for all your help. If you have a coding to change the heading text colour I very much appericate it.
    Message sent to email:
              From: Name test <[email protected]>
                 Content-type: text/html; charset=iso-8859-1
    Name: Name test
              Email: [email protected]
                      Contact No: 0123456789
                      Address1: addy1
                      Address2: addy2
                      Town: T
                      County: C
                      Postcode: P/C
                      Property Type: End of Terrace
                      Property Area: Listed Building
                      Rear ground extension: Rear ground extension: No
                     Side ground extension: Side ground extension: No
                     Two-storey rear extension: Two-storey rear extension: Yes
                     Two-storey side extension: Two-storey side extension: No
                     Loft conversion: Loft conversion: No
                     New build: New Build: No
                     Flat: Flat: Yes
                     Other: Other: No
             Message:
               Test message
    PHP coding for customer contact page:
    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <META HTTP-EQUIV="refresh" content="0;URL=thankyou.html">
    <title>Email Form</title>
    </head>
    <body>
    <?php
      $name=$_POST['name'];
      $contact_number=$_POST['contact_number'];
      $email=$_POST['email'];
      $address1=$_POST['address1'];
      $address2=$_POST['address2'];
      $town=$_POST['town'];
      $county=$_POST['county'];
      $postcode=$_POST['postcode'];
      $propertyType=$_POST['propertyType'];
      $propertyArea=$_POST['propertyArea'];
      $rearExt= isset($_POST['rearExt'])?"Rear ground extension: Yes":"Rear ground extension: No";
      $sideExt= isset($_POST['sideExt'])?"Side ground extension: Yes":"Side ground extension: No";
      $twoStoreyRear= isset($_POST['twoStoreyRear'])?"Two-storey rear extension: Yes":"Two-storey rear extension: No";
      $twoStoreySide= isset($_POST['twoStoreySide'])?"Two-storey side extension: Yes":"Two-storey side extension: No";
      $loft= isset($_POST['loft'])?"Loft conversion: Yes":"Loft conversion: No";
      $newBuild= isset($_POST['newBuild'])?"New Build: Yes":"New Build: No";
      $flat= isset($_POST['flat'])?"Flat: Yes":"Flat: No";
      $other= isset($_POST['other'])?"Other: Yes":"Other: No";
      $message=$_POST['message'];
    // you can specify which email you want your contact form to be emailed to here
      $toemail = "[email protected]";
      $subject = "From Website Test";
      $headers = "MIME-Version: 1.0\r\n
                 From: $name <".$email.">\r\n
                 Content-type: text/html; charset=iso-8859-1";
      $body = "Name: $name\r\n
              Email: $email\r\n
              Contact No: $contact_number\r\n
              Address1: $address1\r\n
              Address2: $address2\r\n
              Town: $town\r\n
              County: $county\r\n
              Postcode: $postcode\r\n
              Property Type: $propertyType\r\n
              Property Area: $propertyArea\r\n
              Rear ground extension: $rearExt\r\n
              Side ground extension: $sideExt\r\n
              Two-storey rear extension: $twoStoreyRear\r\n
              Two-storey side extension: $twoStoreySide\r\n
              Loft conversion: $loft\r\n
              New build: $newBuild\r\n
              Flat: $flat\r\n
              Other: $other\r\n
              Message:\r\n
                $message";
      if (!ereg("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email))
        echo "That is not a valid email address.  Please return to the"
               ." previous page and try again.";
        exit;
        mail($toemail, $subject, $body, $headers);
        echo "Thanks for submitting your message";
    ?>
    </body>
    </html>

  • How to get Checkbox Value from Flex in PHP.

    Hi,
    I need to know how to get a checkbox value from flex in PHP-POST/GET because I don't know what is the value property of a checkbox in flex.
    Please Help.

    Hi,
    It is very simple. Follow the steps below to achieve the solution,
    1. Write a check-box change event to capture the value of the check box. Store this value in a variable(say bolChkSelected:Boolean).
    2. In step 1 you got the value of the check box. Now your aim is to send the value to php. Declare a httpService in your flex application(i think you are aware of using it).Ok..im writing it
    <mx:HTTPService id="sampleService" resultFormat='e4x' url='http://yourdomain/file.php' result='handleResult()' fault='handleFault()'>
    </mx:HTTPService>
    3. Now the actual solution... u need to send the shcStatus in to php..
    Declare an object to hold the data
    var objparameters:Object={};
    objparameters['CheckBoxdata'] = bolChkSelected;
    --in the above line... 'CheckBoxdata' is used as a parameter to php..you shud have the same variable name while accessing in php file also..
    in php file..
    checkboxstatus = $_POST[''CheckBoxdata''];
    echo checkboxstatus
    thats it..

  • Need help with PHP form with checkboxes, radio buttons and file attachment

    Hi guys,
    I'm having a nightmare with this PHP form where a user can fill it in, attach a doc/pdf and submit. After trying to sort it out with previous code I've used, I've stripped it out and think I should just start again in the hope you geniuses can help!
    Here is the HTML of contact.php:
    <form action="" method="post" name="contact" id="contact">
        <p>Job Title:*<br />
        <input name="position" type="text" /></p>
        <p>Nationality:*<br />
        <select name="nationality">
          <option value="">-- select one --</option>
          <option value="Afghan">Afghan</option>
          <option value="Albanian">Albanian</option>
          <option value="Algerian">Algerian</option>
          <option value="Zambian">Zambian</option>
          <option value="Zimbabwean">Zimbabwean</option>
        </select>
        </p>
        <p>Which country are you currently living in?*<br />
        <select name="country">
        <option value="">-- select one --</option>
        <option value="United Kingdom">United Kingdom</option>
        <option value="Afghanistan">Afghanistan</option>
        <option value="Africa">Africa</option>
        <option value="Zambia">Zambia</option>
        <option value="Zimbabwe">Zimbabwe</option>
        </select>
        </p>
        <label class="radio" for="checkRight">Yes/No question?</label><br />
        <input class="radio" type="radio" name="right" value="Yes" /> Yes
        <input class="radio" type="radio" name="right" value="No" /> No
        <input class="radio" type="radio" name="right" value="N/A" /> Not applicable
        <p>Yes/No question?<br />
        <select name="continue">
        <option value="">-- select one --</option>
        <option value="Yes">Yes</option>
        <option value="No">No</option>
        </select>
        </p>
        <p>Select your resorts:<br />
        Resort 1<input name="res1" type="checkbox" value="Resort 1" />
        Resort 2<input name="res2" type="checkbox" value="Resort 2" />
        Resort 3<input name="res3" type="checkbox" value="Resort 3" />
        Resort 4<input name="res4" type="checkbox" value="Resort 4" />
        Resort 5<input name="res5" type="checkbox" value="Resort 5" />
        Resort 6<input name="res6" type="checkbox" value="Resort 6" />   
        </p>
        <p>Don't send form unless this is checked:* <input type="checkbox" name="parttime" value="Yes" /></p>
        <p>Date of arrival: <input name="arrive" id="datepick" /><br />
        Date of departure: <input name="depart" id="datepick2" /></p>
        <script type="text/javascript" src="assets/scripts/datepickr/datepickr.js"></script>
        <link href="assets/scripts/datepickr/datepickr.css" rel="stylesheet">
        <script type="text/javascript">
        new datepickr('datepick');
        new datepickr('datepick2', {
        </script>
        <p>Name:*<br />
        <input name="name" type="text" /></p>
        <p>E-mail:*<br />
        <input name="email" type="text" /></p>
        <p>Telephone:*<br />
        <input name="telephone" type="text" class="ctextField" /></p>
        <p>Upload CV (Word of PDF formats only):<br />
        <input type="file" name="cv" class="textfield"></p>
        <p><input name="submit" value="Submit Enquiry" class="submitButton" type="submit" /><div style="visibility:hidden; width:1px; height:1px"><input name="url" type="text" size="45" id="url" /></div></p>
    </form>
    By the way, the date boxes work so excuse the Javascript in there!
    To prevent SPAM I've used a trick where there's a hidden URL field which must be left blank for the form to submit which you can see in the PHP.
    Below is where I'm at with the PHP which is placed above the header of contact.php...
    <?php
    if (array_key_exists('submit', $_POST)) {
        $position = $_POST['position'];
        $arrive = $_POST['arrive'];
        $nationality = $_POST['nationality'];
        $parttime = $_POST['parttime'];
        $depart = $_POST['depart'];
        $name = $_POST['name'];
        $email = $_POST['email'];
        $telephone = $_POST['telephone'];
    $to = "[email protected]";
    $subject = "Recruitment Application";
    $message = $headers;
    $message .= "Name: " . $_POST["name"] . "\r\n";
    $message .= "E-mail: " . $_POST["email"] . "\r\n";
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    $headers .= 'From: My Website <[email protected]>' . "\r\n";
    $message= "
    $url = stripslashes($_POST["url"]);
    if (!empty($url)) {
    header( 'Location: http://www.go-away-spam-robots.com' );
    exit();
    if (!isset($warning)) {
    mail($to, $subject, $message, $headers);
    header( 'Location: http://www.mywebsite.co.uk/sent.php' );
    ?>
    I would like to make pretty much all the field compulsory so if a field is left empty (other than the hidden URL field), a warning message is displayed next to that field.
    Also I would like the file upload field to attach to the email that is sent to me and have the results come through to me in a table format.
    Can anyone help me get my form working?
    Thank you and I hope to hear from you!
    SM

    Hi Nancy,
    Great stuff, thank you for the reply.
    I've managed to get the Formm@iler working and running as I need it to.
    The only thing I'm struggling with is when the user clicks submit, they are taken to a page of whatever results the form returned but it is just a white background with Times New Roman text.
    How can I have it so the user is taken to the form results in the websites' page layout?
    I tried sending them to a generic 'thank you' page by adding the following code but it just took them there whatever the results of the form so that's no good...! I have a feeling it's a bit more complicated than that...
    header( 'Location: http://www.nofussbus.co.uk/test/sent.php' );
    Thank you for your help!

  • PHP email form checkbox values?

    Hello,
    I'm creating a php email form which part of it consists of a few checkboxes that I need to get the values of. My php knowledge isn't that great therefore I used a tutorial to successfully create the bulk of the form.
    I currently have 7 checkboxes set up as such:
    <input type="checkbox" id="grade_5" name="grade[]" value="Grade 5" />
    Each of these are named "grade[]" to be stored in an array called "grade".
    I know that the values are successfully stored in the array as they show up in the browser when I echo the array.
    $grade = $_POST['grade'];
    $N = count($grade);
    for($i=0; $i < $N; $i++) {
         echo($grade[$i] . " ");
    So, the part I am having trouble with is getting the values to show up in the body of the email.
    $body = "
    Grade Level(s): $grade
    All that is returned in this case is the word "Array" instead of the desired checked grade values.
    Any help is much appreciated! Thank you in advance!
    *Note: All other values (textboxes, selection dropdowns, etc.) are already successfully sent to the email.

    danedmonds wrote:
     All that is returned in this case is the word "Array" instead of the desired checked grade values.
    That's because $grade is an array. If you want to access the values, you need to use a loop. Alternatively, use implode() to turn it into a comma-separated string, like this:
    $grade = implode(', ', $grade);

  • How to add a checkbox to PHP in DW4?

    I'm using DW 4 and need to add a check box/tick box in a PHP document.
    Is there an easy way to do it in DW where it inputs the checkbox code & allows you to add text next to the checkbox?

    If your document has the php extension, then you should see the PHP tab group on your toolbar. Click PHP<Forms< then you should see an option for checkbox or checkbox group which will open a wizard dialog window to walk you through the process.

  • Checkbox - data sent to php

    Hi
    I'm trying to get checkbox data out of flash 8 and in to php
    thate they will be stored in a DB and sent as an e-mail.
    I'm interested in the selected data and ony their label.
    I tried to solve it but now i'm stucked. I'm trying to use
    loadvars to get the data out. Here is the code, hope someone can
    help me finnish it.

    Thanks to both of you for your quick responses.  I am getting a response from the server in Flash now.
    I do have a couple more questions:
    1.  Is there a difference in using:
         loader.dataFormat = URLLoaderDataFormat.VARIABLES
         vs.
         loader.dataFormat = URLLoaderDataFormat.TEXT
    The reason I ask is that I get an error about value pairs if I use the VARIABLES option.  I've also seen some debate on this and wanted to know if one worked better over the other.
    2.  Do the variable names need to match what is being received in the PHP script?  The reason I'm asking is that the PHP script (written by someone else) is looking for two variables, mode and input.  Both of those are keywords in Flash and I wondered if they could be what is causing my problem on the PHP side.
    Thanks!
    -Dave

  • Simple php form help, I think (checkboxes)

    I need a bit of help with some checkboxes in a form being proccessed with php.
    I'm using an array to collect the information then having it emailed.
    <input name="colours[]" value="Red" type="checkbox">Red <br />
    <input name="colours[]" value="Blue" type="checkbox">Blue <br />
    <input name="colours[]" value="Green" type="checkbox">Green <br />
    <input name="colours[]" value="Yellow" type="checkbox">Yellow <br />
    What I'm getting back in the email at the moment is:
    I'm interested in these colours: Array
    Below is the $body of the message:
    $body = "Please contact me regarding the following:\r\n\r\n";
    $body .= "Name: ".stripslashes($_POST['name'])."\r\n";
    $body .= "Address: ".stripslashes($_POST['address'])."\r\n";
    $body .= "Postcode: ".stripslashes($_POST['postcode'])."\r\n";
    $body .= "Telephone: ".stripslashes($_POST['telephone'])."\r\n";
    $body .= "Email: ".stripslashes($_POST['email'])."\r\n";
    $body .= "I'm interested these colours: ".$_POST['colours']."\r\n";
    I guess I need some more php to desl with the array?????
    Thanks
    Os

    Duplicate post. Original has been moved to Dreamweaver Application Development. Locking this thread.

  • Checkboxes in CS6 with PHP

    I cannot build Dynamic check boxes in DWCS6.   The dynamic button in Proprties is not working.  Any help is appreciated.   New at this. 

    Here is my code  - I do not see the checkboxes or any updates.     Thanks.
    <tr>
    <th>Business_type::Acounting</th>
    <td><input type="text" name="Business_type::Accounting" value="<?php echo $port_row->getField('Business_type::Accounting'); ?>">
    <label for="checkbox">Checkbox </label></td>
        <?php
         $variVal="Business_type::Accounting";
       if (!(strcmp($variVal['active'],"Yes"))) {echo "checked=\"checked\"";} 
          if (!(strcmp($variVal['active'],"Yes"))) {echo "checked=\"checked\"";} ?>
    </tr>

  • PHP/MySQL multiple checkbox insert

    Hi All,
    I am creating an order samples page where people can select up to 3 samples.
    The selected checkboxes will go into a database.
    How do I insert the selected checkboxes values into a database? I only managed to insert 1 value.
    Here are the checkboxes:
                             <label><input type="checkbox" name="samples_" value="sample1" id="samples_1">sample1</label>
                             <label><input type="checkbox" name="samples_" value="sample2" id="samples_2">sample2</label>
                              <label><input type="checkbox" name="samples_" value="sample3" id="samples_3">sample3</label>
                              <label><input type="checkbox" name="samples_" value="sample4"  id="samples_4">sample4</label>
                              <label><input type="checkbox" name="samples_" value="sample5" id="samples_5">sample5</label>
                              <label><input type="checkbox" name="samples_" value="sample6"  id="samples_6">sample6</label>
    Any help or advice is much appreciated
    Thanks

    Hi All,
    I am creating an order samples page where people can select up to 3 samples.
    The selected checkboxes will go into a database.
    How do I insert the selected checkboxes values into a database? I only managed to insert 1 value.
    Here are the checkboxes:
                             <label><input type="checkbox" name="samples_" value="sample1" id="samples_1">sample1</label>
                             <label><input type="checkbox" name="samples_" value="sample2" id="samples_2">sample2</label>
                              <label><input type="checkbox" name="samples_" value="sample3" id="samples_3">sample3</label>
                              <label><input type="checkbox" name="samples_" value="sample4"  id="samples_4">sample4</label>
                              <label><input type="checkbox" name="samples_" value="sample5" id="samples_5">sample5</label>
                              <label><input type="checkbox" name="samples_" value="sample6"  id="samples_6">sample6</label>
    Any help or advice is much appreciated
    Thanks

  • PHP Form Labels Don't align with checkbox

    Help!
    I can't seem to get my labels in my sign-up form to align with the checkboxes towards the bottom.  This form is live at www.thectkgroup.com/signup
    Thank you!

    I like to use ordered lists for my form labels.  It's good for web accessibility and it adds some extra hooks for your CSS to grab onto.
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>HTML5 form</title>
    <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <style>
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
    .formpart {
        width: 800px; /**adjust as required**/
        overflow: hidden;/*for float containment*/
    /**wrap form lables and fields inside ordered lists for better web accessibility**/
    .formpart ol {
        list-style: none;
        margin: 0;
        padding: 0
    .formpart li {
        clear: left;
        padding: 16px 0;
    .formpart label {
        float: left;
        line-height: 28px; /**lines up labels with fields**/
        font-size: 18px;
    .formpart input[type=checkbox] {
        width: 2.5em;
        height: 1.5em;
        /**put boxes first**/
        float: left;
    .formpart span {
        color: #999;
        font-style: oblique
    </style>
    </head>
    <body>
    <div class="formpart">
    <p>Please select the class(es) you would like to attend</p>
    <ol>
    <li>
    <label for="contact_classes1">October 28 - 30, 2013: <span>Lee County Sheriff's Office -Fort Madison</span>
    <input id="contact_classes1" name="contact_classes1" type="checkbox">
    </label>
    </li>
    <li>
    <label for="contact_classes2">November 4 - 6, 2013: <span>Waterloo PD &amp; Hawkeye CC</span>
    <input id="contact_classes2" name="contact_classes2" type="checkbox">
    </label>
    </li>
    <li>
    <label for="contact_classes3">March 4 - 6, 2014:<span>Cedar Rapids PD</span>
    <input id="contact_classes3" name="contact_classes3" type="checkbox">
    </label>
    </li>
    <li>
    <label for="contact_classes4">April 2014: <span>Des Moines PD</span>
    <input id="contact_classes4" name="contact_classes4" type="checkbox">
    </label>
    </li>
    </ol>
    </div>
    </body>
    </html>
    Nancy O.

  • PHP Show if hides update fields, but they get overwritten with an empty string

    I have an issue with a page where some update fields are displayed depending on who is logged, for example:
    <?php if ($row_Users['UserID']=="101"){ ?>
    <input <?php if (!(strcmp($row_lodges['101_finalist'],"Yes"))) {echo "checked=\"checked\"";} ?> type="checkbox" name="101_finalist"  value="Yes"/>
    <input type="text" class="rankfield" name="101_rank" value="<?php echo($row_lodges['101_rank']); ?>" />
    <?php }  ?>
    <?php if ($row_Users['UserID']=="102"){ ?>
    <input <?php if (!(strcmp($row_lodges['102_finalist'],"Yes"))) {echo "checked=\"checked\"";} ?> type="checkbox" name="102_finalist"  value="Yes"/>
    <input type="text" class="rankfield" name="102_rank" value="<?php echo($row_lodges['102_rank']); ?>" />
    <?php }  ?>
    The issue I have is that if User101 is logged in and updates fields 101_finalist and 101_rank, it overwrites 102_finalist and 102_rank with an empty string.
    Is it possible to prevent each user from seeing the other fields for other users, and prevent the existing values for those other users not be overwritten?
    Hope that makes sense!
    Thank you.

    That would mean multiple nominations when really there only needs to be one nomination per category in any given country.
    It would be:
    1, 345, 101, Borana Lodge, 7, 2, Yes, 1
    1, 345, 102, Borana Lodge, 7, 2, Yes, 3
    1, 345, 103, Borana Lodge, 7, 2, No, NULL
    Instead of:
    1, 345, Borana Lodge, 7, 2, Yes, 1, Yes, 3, No, NULL
    Sorry, Lodge isn't in the nominations table, the list above is what is displayed on the site. Lodge gets looked up in the Ldoges table.
    At the moment it works like this:
    People can visit a website and vote for lodges in different categories, giving them a score out of 10 for each.
    If a lodge gets a vote in a particular category an admin person creates a nomination for that lodge, in that category.
    And the last bit is where judges login and tag the ones they think should be finalists.

  • Header.php exists but does not show up on every page.

    Hi.  I am starting from scratch with this.
    part1.
    My objective is to create a website that takes advantage of DreamweaverCC's fluid-grid-layout so that my web Site auto-flows on
    smartphones, tablets and desktops/laptops.
    file > new > fluid-grid-layout.
    By default, it says 'unnamed.css'
    I named it  testSite.css
    click okay.
    (This is the only way to begin with a fluid-grid-layout - I think).
    It opens a split view.
    On the right frame is a DIV that has this text inside.
    "Use Insert Panel for additional Fluid Grid Layout Elements. Note: All Fluid Layout tags must be contained within the "gridContainer" div tag."
    In the right frame,
    <script src="file:///Macintosh%20HD/Applications/Adobe%20Dreamweaver%20CC/Configuration/BuiltIn/F luid%20Grid%20Layout/respond.min.js"></script>
    </head>
    <body>
    <div class="gridContainer clearfix">
      <div id="div1" class="fluid">Use Insert Panel for additional Fluid Grid Layout Elements. Note: All Fluid Layout tags must be contained within the "gridContainer" div tag.</div>
    </div>
    </body>
    </html>
    QUESTIONS - CLARIFICATION.
    Question ????
    class = 'gridContainer clearfix"
    div id = "div1 class = "fluid"
    So all of the <div>s that I place inside of the gridContainer will all be assigned the 'class'  fluid.
    Yes ?
    And I define div ids so that I can use css styles
    Yes ?
    I understand class in Java but I do not understand it here in Dreamweaver.
    Please explain.
    part2.
    I inserted 4 <div>s into the gridContainer and assigned them specific div ids.
    div id = square1
    div id = square2
    div id = square3
    div id = square4
    I see these assignments in the code.
    But in the properties panel with HTML (not css panel) selected. 
    It shows  ID None.
    Question ????
    Why doesn't the assigned div =id  in the code show in the properties panel.
    part3a.
    index.php is my main web page.
    It has several images (the 4 different squares).
    I created a separate .html file for each square: square1.html square2.html square3.html square4.html.
    At this point, each of those pages has only one sentence.  'contents for square#N) will be on this page'
    I used the properties panel and linked the 4 images on index.php to these .html files.
    When I 'View in Safari/Firefox'  each of those images (squares) when clicked - bring me to the appropriate page.
    So I've got some of this working
    part3b.
    I know that some of you have already tried to assist with this but it is not working for me.
    I created a file called header.php
    The contents of header.php does not have any <tags> at all.
    The contents is this:
    <h1> This will be the header for all of my web pages.</h1>
    In index.php I included this in the code as such:
    <body>
    <? php require_once('header.php'); ?>     // this is line 34
    <div class="gridContainer clearfix">
      // div ids for the images etc. etc.
    </body>
    </html>
    View in Safari/Firefox
    Parse error: parse error in /Library/WebServer/Documents/dwwdSite/index.php on line 34
    I tried this.
    <? php include_once('header.php'); ?>
    <? php include('header.php'); ?>
    and I get the same exact error.
    When I 'view in Safari/Firefox'  header.php  it displays what I want:
    This will be the header for all of my web pages.
    Question ????
    What am I doing incorrectly ?
    From one of my other posts - as we got onto this topic, it was suggested that I just place the php code:
    <? php  include('header.php'); ?>
    within the index.html file exactly where I want it to show up.
    I want it to show up at the top of each page.
    Well at this point it is not showing up anywhere !!
    But if I have header.php active in Dreamweaver and 'view in safari/firefox'
    the browser does show the header.php page.
    part4.
    Question ????
    And should I include
    <? php require_once('header.php'); ?>
    at the top of each of the square.html files if I want the header to show up on each of those pages.
    I think this makes sense.
    part5.
    Question ????
    When I view testSite.css
    I understand that it has 3 different sets of selectors for each of the 3 different devices.
    But how do I 'assign'  css properties to the contents inside of header.php ?
    With header.php active/open, from the 'properties panel' I can select CSS and choose: font, size, color from there and it works
    but should I not have this included in the testSite.css ?
    Lots of questions. Hope that I explained it in an organized fashion.
    thanks again.
    Nancy O.
    Sudarshan Thiagarajan

    > So all of the <div>s that I place inside of the gridContainer will all be assigned the 'class'  fluid.
    Nope - but everything that you insert using the Insert panel will give you the opportunity to specify that it's a fluid element, which you can do by enabling the checkbox on the dialog. This means that you CAN insert a <div> that is not a fluid element. It's only the ones that you insert as a fluid element that will get that class automatically.
    >And I define div ids so that I can use css styles
    Assigning an ID to any element on the page allows you to target that element with a particular CSS rule.
    > I understand class in Java but I do not understand it here in Dreamweaver.
    > Please explain.
    There is no similarity at all. There are four ways you can identify a page element to apply a CSS rule:
    1. By tag, e.g., all paragraph tags on the page.
    2. By context, e.g., any paragraph tag that is within a <nav> element.
    3. By 'class' assignment, e.g., any element that has been given a particular "class" attribute -> <p class="foo">
    4. By ID, e.g., any element that has been given a particular "ID" attribute -> <p id="foo">
    The weight of any style (i.e., which one to use in the event of conflict) is determined by a number of characteristics of the CSS 'selector' that carries the rule.
    > Why doesn't the assigned div =id  in the code show in the properties panel.
    Assuming your code is correct, it will, e.g.,
    <div id = "square1"></div>
    <div id = "square2"></div>
    <div id = "square3"></div>
    <div id = "square4"></div>
    Try this -
    <html>
    <head></head>
    <body>
    <?php require_once('header.php'); ?>     // this is line 34
    <div class="gridContainer clearfix">
      // div ids for the images etc. etc.
    </body>
    </html>
    and I get the same exact error.
    Yes - there is no space in "<?php".
    Let's start with that.

  • How to get selected values (using checkBox) from DataGrid in flex.

    i have a datagrid which is getting values from a XML file (getting this xml file from database using PHP and HTTP request in flex). i have created a checkbox in every row in data grid. and here is my requirement: i want to select tow or three check-box and would like to get all the values form that particular ROWs in some form , prefered arraycollection (such that i can pass this array directly to a bar chart) .. can some one help me as i am new to flex .
    code ......
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="siteData.send()">
              <mx:Script>
                        <![CDATA[
                                  import mx.collections.XMLListCollection;
                                  import mx.controls.*;
                                  import mx.events.ListEvent;
                                  import mx.rpc.events.ResultEvent;
                                  import mx.controls.Alert;
                                  [Bindable] private var fullXML:XMLList;
                                  private function contentHandler(evt:ResultEvent):void{
                                            fullXML = evt.result.values;
                        ]]>
              </mx:Script>
              <mx:VBox>
                        <mx:Label text="This Data Grid is loading the full XML file"/>
                        <mx:DataGrid width="600"  id="datagrid" dataProvider="{fullXML}">
                                  <mx:columns>
                                            <mx:DataGridColumn headerText="Select">
                                                      <mx:itemRenderer>
                                                                <mx:Component>
                                                                          <mx:HBox horizontalAlign="center">
                                                                                    <mx:CheckBox id="check"/>
                                                                          </mx:HBox>
                                                                </mx:Component>
                                                      </mx:itemRenderer>
                                            </mx:DataGridColumn>
                                            <mx:DataGridColumn dataField="release_version" headerText="Release"/>
                                            <mx:DataGridColumn dataField="build" headerText="build"/>
                                            <mx:DataGridColumn dataField="time_login" headerText="time_login"/>
                                            <mx:DataGridColumn dataField="time_tunnel" headerText="time_tunnel"/>
                                            <mx:DataGridColumn dataField="rate_login" headerText="time_tunnel"/>
                                            <mx:DataGridColumn dataField="rate_tunnel" headerText="rate_tunnel"/>
                                  </mx:columns>
                        </mx:DataGrid>
              </mx:VBox>
              <mx:HTTPService url="http://localhost/php_genxml.php" id="siteData" result="contentHandler(event)" resultFormat="e4x"/>
    </mx:Application>
    as you can see in the image , i will get this datgrid . now i want to select two or three checkboxes and would like to get all the values form the perticular row (for which check box is selected). i would like to get in array from such that i can driectly pass them to bar chart....
    can some one help me in this. as i m new to flex. or if you have some other suggestion ...My final requirement is: select some values and generate bar gharph for those values.
    please help me in this.
    thanks
    tanuj

    Hi Timo -
    Thanks for the suggestion. I could get the values as below:
    public void multiOpUnitValChange(ValueChangeEvent valueChangeEvent) {
    // Add event code here...
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding opUnitIter = (DCIteratorBinding)bindings.get("OperatingUnit2VOIterator");
    Integer[] values = (Integer[])valueChangeEvent.getNewValue();
    for (int i=0; i<values.length; i++){
    Row row = opUnitIter.getRowAtRangeIndex(i);
    System.out.println(row.getAttribute("OpUnitId"));
    Thanks -
    Rohit

Maybe you are looking for

  • Why does my payment method keep being denied?

    I keep  trying to load my Visa card as a payment method to purchase apps, and a message pops up saying it isn't supported. Anyone know why this is? I'm a military member currently serving in Germany, does the country have anything to do with it?

  • System.out console in GUI

    hi i'm constructing a GUI for one of my programs using the swing librarys however i cant figure out how to display the system.out's. I really have no idea how to do it or i would post how im trying to or usual if anyone knows a better way to print st

  • Parse error with print

    Hi, I tried to build a custome web gallery into LR 4.3 on MAC. I started with example from LR SDK zip. In my index.html sample file, i simply declare some variables at the top like this: <%--[[ Define some variables to make locating other resources e

  • An IE reset deletes all favorites?

    Hi - I was in the process of troubleshooting a browser issue for a user.  I went to Tools > Internet Options > Advanced and clicked the RESET button.   Now all of his favorites are gone.     I was under the impression that the Favorites stayed intact

  • Bookmark in JSP

    Hi everyone, I am developing one application in JSP. I need bookmark functionality in it. I have also implemented it in my application. Whenever i clicked on link it saved as bookmark. This thing is properly working in Internet explorer. But i am fac