simple form problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ecaandrew
Forum Commoner
Posts: 72
Joined: Fri Nov 12, 2004 5:05 pm

simple form problem

Post by ecaandrew »

Code: Select all

<td valign="middle"> <select name="build1">
<option value="168">Fedora Core 3 [$0.00/mo.][$0.00/setup]</option>
<option value="167">FreeBSD 5.3 [$0.00/mo.][$0.00/setup]</option>
<option value="152">FreeBSD 4.10 [$0.00/mo.][$0.00/setup]</option>
<option value="130">Fedora Core 2 [$0.00/mo.][$0.00/setup]</option>
<option value="92">FreeBSD 5.2 [$0.00/mo.][$0.00/setup]</option>
<option value="64">Fedora Core 1 [$0.00/mo.][$0.00/setup]</option>
<option value="54">Redhat 7.3 [$0.00/mo.][$0.00/setup]</option>
<option value="53">Redhat 8 [$0.00/mo.][$0.00/setup]</option>
<option value="29">FreeBSD 4.9 [$0.00/mo.][$0.00/setup]</option>
<option value="28" selected>RedHat 9 [$0.00/mo.][$0.00/setup]</option>
<option value="25">Windows 2003 Web Edition [$25.00/mo.][$0.00/setup]</option>
<option value="108">Windows 2003 Standard Edition [$30.00/mo.][$0.00/setup]</option>
<option value="109">Windows 2003 Enterprise Server [$40.00/mo.][$0.00/setup]</option>
<option value="162">Debian (not supported) [$0.00/mo.][$50.00/setup]</option>
</select> </td>
</tr>
<tr> 
<td valign="middle" width="50">&nbsp;</td>
<td valign="middle" align="right">CPU:&nbsp;</td>
<td valign="middle"> <select name="build2">
<option value="116" selected>Dell 600SC 2.4GHz 533MHz FSB [$75.00/mo.][$0.00/setup]</option>
<option value="99">Dell P4-2.8GHz 400SC HT [$99.00/mo.][$0.00/setup]</option>
<option value="134">12 mo. Rent to own Dell P4-2.8GHz 400SC HT [$119.00/mo.][$0.00/setup]</option>
<option value="9">Dell P4-2.8GHz 400SC HT [$79.00/mo.][$79.00/setup]</option>
</select> </td>
</tr>
basically i need to figure out how to make it so when you hit submit, to tell the PHP if its charging monthly or SETUP and display the final monthly price and setup... my friend said to use explode or something, but can somone help me little please, thx... :) :D :o :o
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

well im assuming you have those numeric values mapped to the plans, right?

so if they submit 162 which means debian w/ a monthly fee of $0 and a $50 setup, youll need some way to know this. do you have that part worked out or is that what your asking for help w/ ?

you could use a database, or just an array as so:

Code: Select all

<?php

$plans = array(
    '168' => array('name' => 'Fedora Core 3',  'setup' => '0.00', 'monthly' => '0.00'),
    '167' => array('name' => 'Free BSD 5.3',  'setup' => '0.00', 'monthly' => '0.00'),
);

?>
then you can loop through the array and get the data you want which corresponds to the 3 digit number they submitted
ecaandrew
Forum Commoner
Posts: 72
Joined: Fri Nov 12, 2004 5:05 pm

Post by ecaandrew »

thankyou
Post Reply