...

View Full Version : Problems with 2 forms



holty
01-07-2004, 10:05 AM
All,

I have 2 forms on my php page.

Initially when you visit the page only one form is on view. The form is simply a dropdown box with a list of car models......

Upon selecting your car it passes the model_id into a stored procedure which returns the values for the input boxes for the next form (this is an update form).

The problem that I'm having is that I would like to show the model name selected in the first forms list (at the top) once you have selected a model.

As the value returned from the select is the model_id and not the name, I'm having problems trying to get the model name out.



<td>Select Model: </td>
<td><select name="cboModel">
<?php if (!(isset ($_POST['cboModel']))) { //so when it first loads, this will be False
echo ('<option value ="">Please Select</option>');
}else{
echo ('<option value = "'. $_POST['cboModel'] .'">' . $_POST['cboModel'] . '</option>');
}


So at the moment, if the first form has been selected it will show the model_id and not the name.

I tried to do this when i build the select box from the stored procedure to return the model name:



echo ('<option value = "modelid='. $model_id .'&modelname=' . $modelname . '">' . $modelname . '</option>');


this then stored both the model_id and model name in the value for cboModel, but I couldn't get the name out.

Is there any way to to this, without me calling another stored procedure to return the model name for a specific model_id?

Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum