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.
Edited by Orjan, 28 October 2009 - 01:54 AM.
Please, use code, html and/or php tags for code...


Sign In
Create Account


Back to top











