9 months ago

Laravel Forms

Posted 9 months ago by konrms

Hello my friends!

I want to create a form where a user enters a number and after clicking submit button, this number to appear on the screen. I want to learn how to do it (and afterwards I want to try to inject that number into a query for retrieving results from a db. Thank to your help I managed to connect laravel to my local oracle instance).

  1. I have created my form which is the search.blade. I want after clicking "Αναζήτηση" a new window open with the AM. The code is below:
<!DOCTYPE html>
<html lang="en">

    <meta charset="UTF-8">
    <!--<link rel="stylesheet" type="text/css" href="form_style.css">  -->
    <title>Εισαγωγή Δεδομένων Χρήστη</title>

<k1 class = "myhome">Εισαγωγή Δεδομένων</k1>

<form method="post" action="dedomena" id="forma">



        Αριθμός Μητρώου:<br>
        <input type="number" name="AM" min="1000000" max="9999999"><br>
        <input type="submit" value="Αναζήτηση">

  1. Below is my routes file. Should I use the post for taking data from search?

| Application Routes
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.

Route::get('/search', '[email protected]');

Route::post('/dedomena', '[email protected]');
  1. And the PagesController:
<?php namespace App\Http\Controllers;

class PagesController extends Controller {

    public function search()
        return view('search');
  1. Finally the dedomena.blade should be created to open after clicking "Αναζήτηση".

Please sign in or create an account to participate in this conversation.