a4udi
12-16-2008, 10:01 PM
I have a form that is somewhat long, so I'd like to only show certain fields if they are necessary, but my code isn't working. Is there an easier way to do this, or do I just need to fix something??
What I want here is a selection box where users can choose to be paid via paypal or by check.
<select name="payment">
<option value="" <?php if($_POST["payment"] == ""){ echo('selected="selected"'); } ?>>Select Payment Method</option>
<option value="Check" <?php if($_POST["payment"] == "Check"){ echo('selected="selected"'); } ?>>Check</option>
<option value="Paypal" <?php if($_POST["payment"] == "Paypal"){ echo('selected="selected"'); } ?>>Paypal</option>
</select>
Please select the method you would like:
<?php if($_POST["payment"] == "Check"){
echo('check details and fields will go here if applicable'); }
if($_POST["payment"] == "Paypal"){
echo('paypal information will go here if applicable'); }
if($_POST["payment"] == ""){
echo('make a selection</font>');}
?>
What I want here is a selection box where users can choose to be paid via paypal or by check.
<select name="payment">
<option value="" <?php if($_POST["payment"] == ""){ echo('selected="selected"'); } ?>>Select Payment Method</option>
<option value="Check" <?php if($_POST["payment"] == "Check"){ echo('selected="selected"'); } ?>>Check</option>
<option value="Paypal" <?php if($_POST["payment"] == "Paypal"){ echo('selected="selected"'); } ?>>Paypal</option>
</select>
Please select the method you would like:
<?php if($_POST["payment"] == "Check"){
echo('check details and fields will go here if applicable'); }
if($_POST["payment"] == "Paypal"){
echo('paypal information will go here if applicable'); }
if($_POST["payment"] == ""){
echo('make a selection</font>');}
?>