i want to get the name of selected option in dropdown.
I have a dropdown that displays course names and id from database. Now I want get the name of that course where it implement in value. but in insert query select not get name. How do i do that? Thanks
<?php
<select name='course' onchange=\"reload(this.form)\"><option value=''>Select one</option>";
foreach ($dbo->query($quer2) as $noticia2) {
if($noticia2['id']==@$cat){echo "<option selected value='$noticia2[id]'>$noticia2[class]</option>"."<BR>";}
else{echo "<option value='$noticia2[id]'>$noticia2[class] </option>";}
}
</select>";
if(isset($_REQUEST['sub']))
{
$a=$_REQUEST['course']; //in this i want to insert name not id of select option
}
?>
Your server get's only the data in the value
property and the name
of the select element passed on requests, not the Name of the options. If you want to get the class
instead of the id
, use the class
as the value:
echo "<select name='course' onchange=\"reload(this.form)\"><option value=''>Select one</option>";
foreach ($dbo->query($quer2) as $noticia2) {
if($noticia2['id']==@$cat){
echo "<option selected value='".$noticia2["class"]."'> ".$noticia2[class]".</option>"."<BR>";}
else{echo "<option value='".$noticia2["class"]."'>".$noticia2["class"] ."</option>";
}
}
echo "</select>";
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I’m looking for something that has its own debugger, or I can easily step through the code
Walker navigation menu in Wordpress does not work when I change the label name for different onesThe theme is this
I have this string: Deportivo La Coruña, if I return it I'll get: Deportivo la coruña, so I tried to handle the encoding in this way:
I am using codeigniter3now i want to delete a record then it display database following error