Thursday, 22 August 2013

PHP/HTML: help me to match the variables to my html form to php

PHP/HTML: help me to match the variables to my html form to php

I have a html form and use the get method
I want to input the data to shoes_sales.txt if the user select shoes
option value, and input all the rest to clothes_sales.txt. unfortunately
no ones showing up in my .txt i think theres something in my html
(here im just post my html form line)
<li class="form-line" id="id_16">
<label class="form-label-left" id="label_16" for="input_16">
Select choice </label>
<div id="cid_16" class="form-input">
<select class="form-dropdown" style="width:150px" id="input_16"
name="q16_selectFrom16">
<option value="Shoes"> Shoes </option>
<option value="Clothes"> Clothes </option>
</select>
</div>
</li>
im kinda confuse how i can match these php :(
<?php
header("Location: thankforsumbitting.html");
if ($_GET['variable1'] == "shoes") {
$handle = fopen("shoes_sales.txt", "a");
}
else {
$handle = fopen("clothes_sales.txt", "a");
}
foreach($_GET as $variable => $value) {
fwrite($handle, $variable."=".$value."\r\n");
}
fclose($handle);
exit;
?>
help please im kinda new here ..so please be gentle thank you guys :D

No comments:

Post a Comment