HeTz
11-18-2003, 07:45 PM
I've read the posts around here concerning PHP in templates and found that it is nearly impossible. I was wondering if there were possibly ways around it. Here's what I'm trying to do:
I'm designing a new feature for our RX-8 Club. It allows you to add your vehicle information into your profile. We have three types of owners we're aiming at: Mazda Protege, Mazda RX-7, and Mazda RX-8. Now... when a user's goes to add their car, they have 4 HTML form boxes: Year, Model, Color, and Options. These boxes are automatically filled from an SQL database when they select a certain item. Such as, if they select 2004, only the Prot?g? and RX-8 will be available Models... If they Select 1995, only the Prot?g? and the RX-7 will be available Models... and so on for Color and Options. Now - These HTML select boxes operate off of PHP code. This is an example of one of the select boxes' code:
<?php
SelectBox ("Year", "reg_caryear");
?>
That's for the Vehicle Year (also has Model, Color, Options). Then, also I need this PHP function:
<?php
function SelectBox( $Label, $selectName ){
?>
<tr ALIGN="LEFT">
<td width="15%"><?php echo $Label ?></td>
<td align="left">
<select name="<?php echo $selectName ?>">
<option></option><option></option><option></option>
<option>--------- Not Yet Loaded ---------</option>
</select>
</td>
</tr>
<?php
}
?>
Here's a demo of what I'm talking about:
http://www.lanops.net/rx8club/test/select.php
Is this possible any other way? This is the only way I have figured out how to do auto-populated form boxes... Thanks everyone for your help.
I'm designing a new feature for our RX-8 Club. It allows you to add your vehicle information into your profile. We have three types of owners we're aiming at: Mazda Protege, Mazda RX-7, and Mazda RX-8. Now... when a user's goes to add their car, they have 4 HTML form boxes: Year, Model, Color, and Options. These boxes are automatically filled from an SQL database when they select a certain item. Such as, if they select 2004, only the Prot?g? and RX-8 will be available Models... If they Select 1995, only the Prot?g? and the RX-7 will be available Models... and so on for Color and Options. Now - These HTML select boxes operate off of PHP code. This is an example of one of the select boxes' code:
<?php
SelectBox ("Year", "reg_caryear");
?>
That's for the Vehicle Year (also has Model, Color, Options). Then, also I need this PHP function:
<?php
function SelectBox( $Label, $selectName ){
?>
<tr ALIGN="LEFT">
<td width="15%"><?php echo $Label ?></td>
<td align="left">
<select name="<?php echo $selectName ?>">
<option></option><option></option><option></option>
<option>--------- Not Yet Loaded ---------</option>
</select>
</td>
</tr>
<?php
}
?>
Here's a demo of what I'm talking about:
http://www.lanops.net/rx8club/test/select.php
Is this possible any other way? This is the only way I have figured out how to do auto-populated form boxes... Thanks everyone for your help.