Send a certain value ignore others

hello, have this code below it works well the code displays both state_id and states in options, and
send both state_id and states to database table, i only want state_id to be sent

value="' . $row['car_id'] . '' . $row['car'] . '"

        $query = "SELECT car_id,  car FROM " . $DBPrefix . "vechicle";
        $db->query($query, $params);
        $TPL_ride1_list = '<select name="ride1">' . "\n";
        while ($row = $db->fetch())
        {
            $selected = ($row['car_id'] . '' . $row['car'] == $ride1) ? 'selected="true"' : '';
            $TPL_ride1_list .= "\t" . '<option value="' . $row['car_id'] . '' . $row['car'] . '" ' . $selected . '>' .$row['car'] . '</option>' . "\n";
        }
        $TPL_ride1_list .= '</select>' . "\n";

i know changing the table from var to int will filter out text i just dont want to risk it cause some cars will definately have numbers in there names and will end up messing with the id number, thanks.

Just take out the $row[‘car’] in the value=“”.

if i do that it will submit both d name and its value.

or rather is there a way to display the name but submit it id instead?

YES, there is.
Just take out the $row[‘car’] in the value=“”.

if i do that i will only have car_id displaying in the user options

You have been told two times to remove it from only value attribute, but nobody said you should remove it from between option tags.

oh yeah, sorry my bad forgot include that, the code looks that way cause the first part shows the value selected the part shows what been selected before being submited

it doesn’t matter.
just do what you’ve been told

it does, cause

' .$row['car'] . '

which means page one you get something like this

toyota
benz
blabla

after submit you get directed to page two to confirm your selection which shows car_id and cars(name) but i want only car_id to be finally submitted.

hope u understand now

forget about any other page now. make this one work and then ask another question if you have another trouble.

its the same page more like a confirm page after choosing selection

in PHP there are no “same pages”. each page shown is served by a distinct call.

well since am using template TPL as html i can simply load every page in one page

Ah, that would probably have been useful information at the start - you never mentioned that you were using a template system, and not everyone will remember from your last thread.

In any case, it’s not relevant. Your question is really about HTML, not PHP - you’re just using PHP to create your HTML. So your output needs to be

<option value="1">Toyota</option>
<option value="2">Audi</option>

whichever method you use to create it. Right now you are outputting

<option value="1Toyota">Toyota</option>
<option value="2Audi">Audi</option>

If the extra data is appearing when you render the confirmation page, then it’s just because you haven’t updated the code for both pages.

oh okay thats about right droop, how do i out that into this

<option value="' . $row['car_id'] . '' . $row['car'] . '" ' . $selected . '>' .$row['car'] . '</option>

? thanks

Hang on, how have we gone from car manufacturers to teams?

In any case, it’s the same. You can see where you concatenate the team_id and teams fields, just drop whichever one you don’t want.

lol sorry copied something different
<option value="' . $row['car_id'] . '' . $row['car'] . '" ' . $selected . '>' .$row['car'] . '</option>

OK, well, same thing but with different names. Just take out the one you don’t want, as mentioned earlier in the thread.

thats the problem, code looks like this now
<option value="' . $row['car_id'] . '" ' . $selected . '>' .$row['car'] . '</option>

remember i said something about confirming

it looks like this now
first page you get this
yoyota
benz
blabla

once i select any one on the confirm page i get

3, 3 as in the car_id of benz but the user might not remember what 3 stands for thats y am looking for a way to display both car_id and car but send only car_id hope u understand my issue now

I thought I understood it before. Show the code from the confirm page, if that’s the one you are having trouble with.

Personally, I would only display the car name - the user doesn’t need to see the id. Just put the ID in the option value as you have above, and display the name between the option values.