Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2009
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Help - Converting values

    Need help converting the code where it will accept and process
    inputs from checkbox to text

    This is the html code:

    <form action="process.php" method="post">
    <p>What is your name?</p>
    <p><input type="text" name="customer_name"></p>

    <p>What orders do you want?</p>
    <p>
    <input type="checkbox" name="hworder[]" value="order01"> Order01
    <br />
    <input type="checkbox" name="hworder[]" value="order02"> Order02
    <br />
    <input type="checkbox" name="hworder[]" value="order03"> Order03
    <br />
    <input type="checkbox" name="hworder[]" value="order04"> Order04</p>
    <input type="submit">
    </form>


    This is the process.php code:

    <?php

    $hworder = $_POST["hworder"];
    $customer_name = strval($_POST["customer_name"]);

    if (is_array($hworder)) {
    foreach ($hworder as $key => $value) {
    print "$customer_name ordered $value .<br>";
    }
    }

    ?>

    It processes the checkboxes with no problem when I convert to text and try to get only values that I've submitted. Instead of receiving all.

    Ok thats where I'm at.
    Help please.

  • #2
    New Coder
    Join Date
    Jan 2009
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I'm just now learning how to get information from one page to another. So I'm using a script that I found and modifying it to where instead of using checkboxes I can receive info from text input and receive only that which was entered and submitted

  • #3
    Regular Coder
    Join Date
    Dec 2007
    Posts
    107
    Thanks
    0
    Thanked 3 Times in 3 Posts
    while (list ($key,$val) = @each ($hworder)) {
    echo "$val,";
    }


    just try this to see if it is printing values for the checkboxes or not?
    Programming & Webmaster Forum - AdSense Revenue Sharing forum

  • #4
    New Coder
    Join Date
    Jan 2009
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I'm not looking for set values as a check box would have I'm needing to extract values that are input as in through a text box

  • #5
    New Coder
    Join Date
    Jan 2009
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts
    thats just it i'm not wanting to use checkboxes i want to know how to use text boxes where i can recieve data input from a form and data that is all readly set. i just don't know how to format the php to recieve it


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •