How to change html Form to simple html?

How to change html Form to simple html:

{{ Form::select('sort', $sorts , $selectedSort ,array('onChange' => 'this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);')) }}

I change the form to this html form : what I have to add?

<select name="sort"  onchange="this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);">

    @foreach($sorts as $sort)
                                    <option value="">{{$sort}}</option>
                                        @endforeach
                                    </select>

controller:

$this->data['sorts'] = [
			url('products') => 'Default',
			url('products?sort=price-asc') => 'Price - Low to High',
			url('products?sort=price-desc') => 'Price - High to Low',
			url('products?sort=created_at-desc') => 'Newest to Oldest',
			url('products?sort=created_at-asc') => 'Oldest to Newest',
		];

		$this->data['selectedSort'] = url('products');
private function _sortProducts($products, $request)
	{
		if ($sort = preg_replace('/\s+/', '', $request->query('sort'))) {
			$availableSorts = ['price', 'created_at'];
			$availableOrder = ['asc', 'desc'];
			$sortAndOrder = explode('-', $sort);

			$sortBy = strtolower($sortAndOrder[0]);
			$orderBy = strtolower($sortAndOrder[1]);

			if (in_array($sortBy, $availableSorts) && in_array($orderBy, $availableOrder)) {
				$products = $products->orderBy($sortBy, $orderBy);
			}

			$this->data['selectedSort'] = url('products?sort='. $sort);
		}
		
		return $products;
	}

and I tried to change this too:

<div class="form-group mx-sm-3 mb-2">
		{{ Form::select('status', $statuses, !empty(request()->input('status')) ? request()->input('status') : null, ['placeholder' => 'All Status', 'class' => 'form-control input-block']) }}
	</div>

to this:

	<div class="form-group mx-sm-3 mb-2">
	
	<select name="status"  class="form-control input-block">
	<option value="{{!empty(request()->input('status')) ? request()->input('status') : null}}" >All status</option>
     @foreach($statuses as $status)
     <option value="{{ $status }}" >{{ $status }}</option>
     @endforeach
</select>

	</div>

Controller:

$this->data['statuses'] = Order::STATUSES;
public function index(Request $request)
{
	if ($request->input('status') && in_array($request->input('status'), array_keys(Order::STATUSES))) {
			$orders = $orders->where('status', '=', $request->input('status'));
		}
}

what I have to add or change to make select option work correctly and thank you very much

Why exactly do you want to reverse engineer something that looks to have been intentional used. An API that seems like an integral part of the project you are working on. If its because you don’t understand it and *think it would be better as just html I would urge you to reconsider the consequences of removing it and trying to replace it with spaghetti code.

thank you I want to use simple html (and to learn the difference between them and if I will use Form I want to understand what to add in code) so please how to change that and thank you very much

That appears to be using a framework. Do you know what framework is being used.

Thank you very much , laravel 6

I haven’t worked with Laravel or php for several years. So while I can point you in the right direction specific details are beyond me without research.

thank you very much

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.