So i have this code. The top input does get sent to the email but the bottom doesnt (Tank I.D.). I need to get the second part working. I looked at a similar one where it used $v['example'] instead of $_POST['example'] and i'm not entirely sure what the difference would be.
Gallons of required storage:<br />
<input name="required_storage" type="text" size="10" value="<?php if(isset($_POST['sub'],$_POST['required_storage'])){echo $_POST['required_storage'];} ?>" /><br />
Tank I.D. in feet (O.D. will be 4"-10" larger than I.D.) <br />
<select name="Tank I.D. in feet" value="<?php if(isset($_POST['sub'],$_POST['Tank I.D. in feet'])){echo $_POST['Tank I.D. in feet'];} ?>">
<option value="26 inches">26"</option>
<option value="30 inches">30"</option>
<option value="3'">3'</option>
<option value="4'">4'</option>
<option value="5'">5'</option>
<option value="6'">6'</option>
<option value="7.8'">7.8'</option>
<option value="9.2'">9.2'</option>
<option value="11.12'">11.12'</option>
<option value="13.12'">13.12'</option>
</select>
plus I do not have an item in there named sub
but the code reccomended to me always includes if(isset($_POST['sub'],$_POST['option name']))
can anyone explin why i need that?
Let me see if I can give you a better example. Just because you are new to PHP, it doesn't make this a bad question, you just need to work on your logic and PHP syntax.
<?php
$options = array(
"26 inches" => "26\"",
"30 inches" => "30\"",
"3 feet" => "3'",
// put all the rest here
);
?>
Gallons of required storage:<br />
<input name="required_storage" type="text" size="10" value="<?php echo array_key_exists('required_storage', $_POST) ? $_POST['required_storage'] : ''; ?>" /><br />
Tank I.D. in feet (O.D. will be 4"-10" larger than I.D.) <br />
<select name="tank_feet">
<?php foreach ($options as $key => $val): ?>
<option value="<?php echo $key; ?>"<?php echo ($val == $_POST['tank_feet'] ? ' selected="selected"' : ''); ?>><?php echo $val; ?></option>
<?php endforeach; ?>
</select>