Support the ongoing development of Laravel.io →
Requests Forms

Routes.php

Route::get('tool/url_translate', function()
{
    $url = Input::get('url');
    echo $url;
    return View::make('tool.url_translate');
});

tool/url_translate.blade.php

......
{{ Form::open(array('url'=>'tool/url_translate')) }}
	{{ Form::token() }}
	<div class="col-xs-4">
	{{ Form::text('url', '', array('class'=>'form-control col-xs-2', 'placeholder'=>'please enter url')) }}
	</div>
	{{ Form::submit('submit', array('class'=>'btn btn-primary')) }}
{{ Form::close() }}
......

Problem: When I submit this form, it throw an exception.

----------------------------- Exception -----------------------------

Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException

How to do it, anybody can hely me? thanks!

Last updated 3 years ago.
0

your route is only for "get" -->

Route::get

if you post, you should use -->

Route::post

or for both

Route::any
Last updated 3 years ago.
0

I 'm a green hand .Thanks!

Last updated 3 years ago.
0

Or keep the get route and change the form opening to

{{ Form::open(array('url'=>'tool/url_translate', 'method' => 'GET')) }}

Laravel defaults to POST.

Last updated 3 years ago.
0

Thanks. But I like POST better.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

xie123hil xie123hil Joined 1 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.