php - I am working on a Laravel 8 project in which I want to keep the old value in select option in the blade file
问题描述
I know this question is asked many time but don't know why solution is not working for me. I am a beginner and have a very simple confusion. I have a form in Laravel blade with a drop down. Now I want to keep the drop down value selected after the user submit the form. This is the code I applied to make it work from internet but don't know why it is not working.
<select class="form-control" name="company">
<option value="select">Select Type</option>
<option value="Apple" {{ old('company') == "Apple" ? 'selected' : '' }}>Apple</option>
<option value="Google" {{ old('company') =="Google" ? 'selected' : '' }}>Google</option>
<option value="Mi" {{ old('company') == "Mi"? 'selected' : '' }}>Mi</option>
<option value="Samsung" {{ old('company') == "Samsung" ? 'selected' : '' }}>Samsung</option>
</select>
解决方案
推荐阅读
- c# - 在标签页内的列表中使字符串可点击
- boto3 - rds.create_db_instance 的 DBInstanceIdentifier 和 DBName 有什么区别?
- boto3 - 为初始 AWS 应用程序自动扩展添加延迟
- clojure - Clojure - 宏扩展如何在“some”函数内部工作
- python - 从具有重复文件名的不同目录导入文件
- wordpress - WP Rest API 通过带有特殊字符的 slug 发布(例如:!&')
- firebase - 使用 Firebase Crashlytics 获取发生崩溃的用户的 ID
- c++ - 如何递归地将十六进制转换为十进制
- python - 如何摆脱相互更新小部件的循环?
- python - Selenium-Python:无法清除 chrome 浏览器缓存