Need urgent help. RE: Instant price quote form using PHP!
Posted: Fri Feb 19, 2010 4:51 pm
Hey man,
Quick question for you. Okay first go here.
http://www.maaximumseduction.com/test.php
Here is what I am trying to do. This is sort of like an instant quote calculator for any sort of service. In this instance A moving company. You can get an instant quote.
You fill in the data and based on certain calculations, you get on the same page below a quantity or total dollar worth of the costs. So far I only have it adding up the data inputted into Total distance travel in KM and total weight of Boxes.
Here is the code for you to reference.
CODE:
html>
<body>
Get an online quote right now!
<form method="get">
Total distance to travel in KM: <input type="INT" name="distance1" /><br />
Total weight of the boxes in Kg: <input type="INT" name="weight1" /><br />
<input type="submit" name="submit" value="Submit me!" />
</form>
<?php
$first = $_GET['distance1'];
$second = $_GET['weight1'];
$answer = $first + $second;
$money=number_format($answer, 2);
echo "Your total cost is \n" ;
echo "\$", $money
?>
</body>
</html>
<table width="348" cellspacing="5" cellpadding="5">
<tr>
<td width="326" height="410" valign="top"><form method="get">
<table width="310" cellspacing="5" cellpadding="5">
<tr>
<td>Total distance to travel in kilometers:</td>
<td><input type="INT" name="distance2" /></td>
</tr>
<tr>
<td>Total weight of the boxes in kilograms: </td>
<td><input type="INT" name="weight1" /></td>
</tr>
<tr>
<td>Total number of rooms: </td>
<td><input type="INT" name="distance1" /></td>
</tr>
<tr>
<td>Total number of <br>
boxes </td>
<td><input type="INT" name="distance3" /></td>
</tr>
<tr>
<td>What sort of property do you have</td>
<td><select name="property[]" id="property1">
<option selected>Condo</option>
<option>House</option>
<option>Office</option>
</select></td>
</tr>
<tr>
<td>How many trips<br>
do you think the move will take </td>
<td><select name="tripa[]" id="trip">
<option value=1>1</option>
<option>2</option>
<option>3</option>
</select></td>
</tr>
</table>
<p>
<input type="submit" name="submit" value="Submit me!" />
</p>
<p>
<?php
$first = $_GET['distance1'];
$second = $_GET['weight1'];
$third= $_GET['tripa[]'];
$answer = $first + $second + $third;
$money=number_format($answer, 2);
echo "Your total cost is \n" ;
echo "\$", $money
?>
</p>
<p> </p>
</form></td>
</tr>
</table>
Now here is what I am trying to do. I want to know how to take the multiple select list options and put that into a variable.
For instance, there are two list. options boxes in my form.
One for number of trips
and One for type of property.
I want first of all to add, just to test.
the number that is selected by the user in "trips" to $first and $second, but it doesn't add it.
Here is what I am doing. So my select name is "trips"
so I am storing that in a variable called $third= $_GET['trips'];
$third variable, it doesn't add.
I am just wondering how you take input from a multiple select part of a form
and store that in a variable as a number and use .I am assuming an IF/Then statement to store whatever option the user selected into a final variable that gets counted in the ultimate sum.
SO basically, it is for an instant price quote form.
You fill out the form which includes some list option elements and based on whatever option you select, the variable that stores this data is given the equivalent numerical value of that particular form list options or elements value.
and then added to the final sum.
Thanks
Omer
Quick question for you. Okay first go here.
http://www.maaximumseduction.com/test.php
Here is what I am trying to do. This is sort of like an instant quote calculator for any sort of service. In this instance A moving company. You can get an instant quote.
You fill in the data and based on certain calculations, you get on the same page below a quantity or total dollar worth of the costs. So far I only have it adding up the data inputted into Total distance travel in KM and total weight of Boxes.
Here is the code for you to reference.
CODE:
html>
<body>
Get an online quote right now!
<form method="get">
Total distance to travel in KM: <input type="INT" name="distance1" /><br />
Total weight of the boxes in Kg: <input type="INT" name="weight1" /><br />
<input type="submit" name="submit" value="Submit me!" />
</form>
<?php
$first = $_GET['distance1'];
$second = $_GET['weight1'];
$answer = $first + $second;
$money=number_format($answer, 2);
echo "Your total cost is \n" ;
echo "\$", $money
?>
</body>
</html>
<table width="348" cellspacing="5" cellpadding="5">
<tr>
<td width="326" height="410" valign="top"><form method="get">
<table width="310" cellspacing="5" cellpadding="5">
<tr>
<td>Total distance to travel in kilometers:</td>
<td><input type="INT" name="distance2" /></td>
</tr>
<tr>
<td>Total weight of the boxes in kilograms: </td>
<td><input type="INT" name="weight1" /></td>
</tr>
<tr>
<td>Total number of rooms: </td>
<td><input type="INT" name="distance1" /></td>
</tr>
<tr>
<td>Total number of <br>
boxes </td>
<td><input type="INT" name="distance3" /></td>
</tr>
<tr>
<td>What sort of property do you have</td>
<td><select name="property[]" id="property1">
<option selected>Condo</option>
<option>House</option>
<option>Office</option>
</select></td>
</tr>
<tr>
<td>How many trips<br>
do you think the move will take </td>
<td><select name="tripa[]" id="trip">
<option value=1>1</option>
<option>2</option>
<option>3</option>
</select></td>
</tr>
</table>
<p>
<input type="submit" name="submit" value="Submit me!" />
</p>
<p>
<?php
$first = $_GET['distance1'];
$second = $_GET['weight1'];
$third= $_GET['tripa[]'];
$answer = $first + $second + $third;
$money=number_format($answer, 2);
echo "Your total cost is \n" ;
echo "\$", $money
?>
</p>
<p> </p>
</form></td>
</tr>
</table>
Now here is what I am trying to do. I want to know how to take the multiple select list options and put that into a variable.
For instance, there are two list. options boxes in my form.
One for number of trips
and One for type of property.
I want first of all to add, just to test.
the number that is selected by the user in "trips" to $first and $second, but it doesn't add it.
Here is what I am doing. So my select name is "trips"
so I am storing that in a variable called $third= $_GET['trips'];
$third variable, it doesn't add.
I am just wondering how you take input from a multiple select part of a form
and store that in a variable as a number and use .I am assuming an IF/Then statement to store whatever option the user selected into a final variable that gets counted in the ultimate sum.
SO basically, it is for an instant price quote form.
You fill out the form which includes some list option elements and based on whatever option you select, the variable that stores this data is given the equivalent numerical value of that particular form list options or elements value.
and then added to the final sum.
Thanks
Omer