This looks a bit mashed up to me.
I don't understand what the first bit of code does. You're looping through a recordset, but you keep overwriting the session variable with each iteration. And BTW, just use a single set of braces for loops: { ... } not {{ ... }}
Your second loop has all that messy conditional code:
if($_SESSION['svregx'] == $vreg){
//do nothing
}elseif($_SESSION['svregx'] != $vreg){
echo"<option value='$vreg'>$vreg</option>";
}else{
}
You just need this:
if($_SESSION['svregx'] != $vreg){
echo"<option value='$vreg'>$vreg</option>";
}
However, I can't see how you are going to get this to work.
diafol
Keep Smiling
10,832 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,533
Skill Endorsements: 61
This is a bit strange. You populate the select element with numbers from vehicle_info table and then store the chosen number into the same table. You should have a source for the select element somewhere else (maybe some other table) otherwise you keep running in circles. Or have I missunderstood something?
broj1
Nearly a Posting Virtuoso
1,216 posts since Jan 2011
Reputation Points: 167
Solved Threads: 165
Skill Endorsements: 13
So do you get fleet number from the fleetNumbers table? What is the structure of this table? This table has not been mentioned in your previous posts at all.
broj1
Nearly a Posting Virtuoso
1,216 posts since Jan 2011
Reputation Points: 167
Solved Threads: 165
Skill Endorsements: 13
SO to get this right:
TABLES
Vehicle_info
id | ymodel | chassis | color | fleet_no
fleetNumbers
id | fleetNumbers
vreg_no
id | vreg
I'm assuming the following relationship:
fleetNumbers.id (1) -> (many) fleet_no
However, I'm unclear as to how the vreg_no table is related to the vehicle_info table.
BTW - usually a good idea to avoid using the same table and field name as this can result in confusion. Also, when describing a problem, use the same table names and field names that you use in your code.
So to clarify again, which table provides the dropdown info? Which table do you need to use to check in order to remove items from the dropdown?
diafol
Keep Smiling
10,832 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,533
Skill Endorsements: 61
I'm still none the wiser. Sorry, I can't help you. Good luck with it.
diafol
Keep Smiling
10,832 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,533
Skill Endorsements: 61