Click here to Skip to main content
15,938,122 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can't seem to find which part of this code is wrong. After selecting "submit" button the browser should display the date, no. of items, total amount accumulated and other details but instead along the form it displays the rest of the code. Can anyone help me?

<<pre lang="xml">?
<form method='post' action='activity.php'>
<td bgcolor='gray'>Item</td>
<td bgcolor='gray'>Quantity</td>
<td><input type='text' name='value1'></td>
<td><input type='text' name='value2'></td>
<td>Spark Plugs</td>
<td><input type='text' name='value3'></td>
<th colspan=2><input type='submit' value='SUBMIT ORDER' name='submit1'>
<select name='menu'>
        <option selected>I'm A Regular Customer</option>
        <option>TV Advertising</option>
        <option>Phone Directory</option>
        <option>Word of Mouth</option>
if ($_POST['submit1'])
echo "<font size='12' font face = 'Arial'>BOBS AUTO PARTS</font>";
echo "<br><font size='10' font face = 'Arial'>Order Results</font>";
echo "<br><br>";
echo "<br><font face = 'Arial'>Order Processed at ";
echo "<br><br>";
$tire = $_POST['value1'];
$oil = $_POST['value2'];
$spark = $_POST['value3'];
$itemsum = $tire+$oil+$spark;
echo "<br><font face = 'Arial'>".$tire." tire";
echo "<br><font face = 'Arial'>".$oil." oil";
echo "<br><font face = 'Arial'>".$spark." spark plugs";
$prodtire = $tire*2;
$prodoil = $oil*4;
$prodspark = $spark*6;
$prodsum = $prodtire+$prodoil+$prodspark;
$deduction = $prodsum*0.10;
$total = $prodsum-$deduction;
echo "<br><font face = 'Arial'>Your Order is as follows: ".$date1;
echo "<br><font face = 'Arial'>Items Ordered  ".$itemsum;
echo "<br><font face = 'Arial'>Sub Total: $".$prodsum;
echo "<br><font face = 'Arial'>Total: $".$total;
$combobox1 = $_POST['menu'];
echo "<br><br>".$combobox1;
} else
echo $htmltag;

Peter_in_2780 26-Jul-11 2:49am    
Is it as simple as no closing double quote on the second line?
Buena Velasco 26-Jul-11 3:03am    
What closing quote on the 2nd line? Sorry, I'm not that good with PHP yet.
_Zorro_ 26-Jul-11 7:58am    
This line: $htmltag="<html>
Edit: My bad, that's not the problem.
Buena Velasco 26-Jul-11 22:23pm    
hehe.. yeah.. it's got a closing " right after the </html> tag.. Where could be the problem then?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900