Answer the question
In order to leave comments, you need to log in
How to get option value using php?
example. my answer is clothes but I must get 1.
<form method = "post">
<div class="form-group">
<label for="companyType">Company type</label>
<select class="form-control" id="companyType" name="companyType">
<option value="1">clothes</option>
<option value="2">art</option>
<option value="3">furniture</option>
<option value="4">real state</option>
<option value="5">car</option>
<option value="6">electronics</option>
<option value="7">book</option>
<option value="8">toy</option>
<option value="9">building materials</option>
</select>
</div>
<button type="submit" name="companyRegister" class="btn btn-default">Register </button>
</form>
if(isset($_POST['companyRegister'])){
echo data['companyType'];
}
Answer the question
In order to leave comments, you need to log in
$companyType = filter_input(INPUT_POST, 'companyType', FILTER_SANITIZE_NUMBER_INT);
echo $companyType;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question