...

View Full Version : Help - Converting values



ghost2012
10-28-2009, 07:37 AM
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.

ghost2012
10-28-2009, 08:35 AM
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

technica
10-28-2009, 08:44 AM
while (list ($key,$val) = @each ($hworder)) {
echo "$val,";
}


just try this to see if it is printing values for the checkboxes or not?

ghost2012
10-28-2009, 10:07 AM
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

ghost2012
10-29-2009, 07:12 AM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum