I am new at PHP , I am not able to connect my form with database . NotFoundHttpException in RouteCollection.php line 179:

320

**Please Help me with my form connection to database, table is created in database but i am confused how to connect it with my form **

This is my how i am routing my form

      <div id="register" class="animate form">
                        <form action="{{route('signup')}}" method="post" autocomplete="on"> 
                            <h1> Sign up </h1> 

this is my controller

public function postSignup(Request $request)
    {
        $username = $request['username'];
        $email = $request['email'];
        $password = bcrypt($request['password']);


        $user = new User();
        $user->username = $username;
        $user->email = $email;
        $user->password = $password;


        $user->save();
        return redirect()->back();

    }

and here comes my route file :

Route::post('/signup',[
    'uses' => [email protected],
    'as'=> 'signup'

    ]);

error screenshot

629

Answer

Solution:

Your form like this:-

 <form action="{{url('signup')}}" method="post" autocomplete="on"> </from>
                                   Or
 <form action="{{ action('[email protected]')}}" method="post" autocomplete="on"> </from>

And try this route:-

Route::match(['get', 'post'], '/signup', '[email protected]');

Hope it helps!

People are also looking for solutions to the problem: php - Updating a column of the db after inserting

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.