I have facing this error when try to add new categories to store the data, but it seen show me _token error?
CategoriesController.php
public function store(Request $request)
{
Category::create($request->all());
return back();
}
index.blade.php
<a class="btn btn-primary pull-right navbar-right" data-toggle="modal" href="#category">Add Category</a>
<div class="modal fade" id="category">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Add New</h4>
</div>
{!! Form::open(['route' => 'category.store', 'method' => 'post']) !!}
<div class="modal-body">
<div class="form-group">
{{ Form::label('name', 'Title') }}
{{ Form::text('name', null, array('class' => 'form-control')) }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes</button>
</div>
{!! Form::close() !!}
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
Add
protected $fillable = ['name'];
under your Category class.
And use
Category::create($request->only(['name']));
instead of $request->all() which tries to write to categories._token column inside your Category model combined with create().
You should try this:
<a class="btn btn-primary pull-right navbar-right" data-toggle="modal" href="#category">Add Category</a>
<div class="modal fade" id="category">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Add New</h4>
</div>
{!! Form::open(['route' => 'category.store', 'method' => 'post']) !!}
{!! csrf_field() !!}
<div class="modal-body">
<div class="form-group">
{{ Form::label('name', 'Title') }}
{{ Form::text('name', null, array('class' => 'form-control')) }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes</button>
</div>
{!! Form::close() !!}
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
you can also add
protected $guarded = [];
to your model and then you can use mass assignment.
Related
I want to create modal for update one of the column value from bootstrap table. here is the html code for opening modal.
<a href='' id='upload_link' data-id='$row->id' data-toggle='modal' data-target='#myModal'>Upload</a>
This is My Modal Code. In modal I have form and i want to pass data-id value in form action with route {!! Form::open(['route' => ['path_here',data-id] , 'files' => 'true','method' => 'get']) !!} so that i can update value of that particular record. How to pass data-id value in form action. How to do so ! please Help..
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Title</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
{!! Form::open(['route' => ['path_here',data-id] , 'files' => 'true','method' => 'get']) !!}
{!! Form::close() !!}
</div>
<!-- <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div> -->
</div>
</div>
</div>
I had a different page for edit comments - comments/{$id}/edit and I'm trying to add this to a modal in the same page with my comment.The problem is , when I open my modal, I get only first comment of 5, even if I have buttons on all comments.What's happening here?
My view + modal
<div class="col-md-12">
#foreach($post->comments()->latest()->paginate(5) as $comment)
<div class="media g-mb-30">
<img class="d-flex g-width-50 g-height-50 rounded-circle g-mt-3 g-mr-20" src="/storage/{{ $comment->image }}" alt="Image Description">
<div class="media-body g-brd-around g-brd-gray-light-v4 g-pa-30" style="margin-right: -35px">
<div class="g-mb-15">
<h5 class="d-flex justify-content-between align-items-center h5 g-color-gray-dark-v1 mb-0">
<span class="d-block g-mr-10">{{ $comment->username }}
<span class="g-color-black-opacity-0_7 g-pos-rel g-top-2 mx-2">·</span>
<span class="g-color-gray-dark-v4 g-font-size-12">{{ $comment->created_at }}</span>
</span>
<a class="u-tags-v1 g-font-size-12 g-brd-around g-brd-gray-light-v4 g-bg-primary--hover g-brd-primary--hover g-color-black-opacity-0_8 g-color-white--hover rounded g-py-6 g-px-15" href="/profile/{{ $comment->user_id }}">Author</a>
</h5>
</div>
<p>{{$comment->comment}}</p>
<ul class="list-inline d-sm-flex my-0">
#can('update', $post->user->profile)
<li class="list-inline-item ml-auto">
<a href="#" class="u-link-v5 g-color-gray-dark-v4 g-color-primary--hover" data-toggle="modal" data-target="#exampleModal2">
<i class="icon-note g-pos-rel g-top-1 g-mr-3"></i>
Edit comment
</a>
<!-- Modal -->
<div class="modal fade" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="col-md-8 colm-d-offset-2">
<h1>edit comment</h1>
{{ Form::model($comment, ['route' => ['comments.update', $comment->id] , 'method' => 'PUT']) }}
{{ Form::label('comment', "Comment:") }}
{{ Form::textarea('comment', null, ['class' => 'form-control']) }}
{{ Form::submit('Update Comment', ['class' => 'btn btn-success btn-xs']) }}
{{ Form::close() }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
</li>
<li class="list-inline-item ml-auto">
<a class="u-link-v5 g-color-gray-dark-v4 g-color-primary--hover" href="/deleteComment/{{$comment->id}}">
<i class="icon-note g-pos-rel g-top-1 g-mr-3"></i>
Delete comment
</a>
</li>
#endcan
</ul>
</div>
</div>
#endforeach
{{ $post->comments()->latest()->paginate(5)->links() }}
</div>
</div>
</div>
</div>
</div>
</div>
**Here is my old route : **
Route::get('/comments/{id}/edit', ['uses' => 'CommentsController#edit', 'as' => 'comments.edit']);
My controller
public function edit($id)
{
$comment = Comment::find($id);
return view ('comments.edit')->withComment($comment);
}
public function update(Request $request, $id)
{
$comment = Comment::find($id);
$this->validate($request, array('comment' => 'required'));
$comment->comment = $request->comment;
$comment->save();
Session::flash('success', 'Comment updated');
return redirect('/post/' . $comment->post->id);
}
you must set id="{!! $comment->id !!}
<a id="{!! $comment->id !!}" href="#" class="u-link-v5 g-color-gray-dark-v4 g-color-primary--hover" data-toggle="modal" data-target="#exampleModal2">
<i class="icon-note g-pos-rel g-top-1 g-mr-3"></i>
Edit comment
</a>
and if you want access to id by $(this).attr("id"); and send this to modal or ajaxController
Inside a view blade.php, I have a problem passing data within a foreach loop to a outside loop bootstrap modal.
show.blade.php:
{!! Form::open(['method' => 'PATCH','action' => ['OrderController#update',$order_items->id], 'class'=>'table_form']) !!}
#foreach($order_items as $oi)
<tr class="order-form-row">
<td>
{{ $oi->name }}
</td>
<td>
<a class="btn btn-block" data-toggle="modal" data-target="#deleteLineItemModal"><i class="icon-trash"></i></a>
</td>
</tr>
#endforeach
{!! Form::close() !!}
{{--bootstrap modal--}}
<div class="modal fade" id="deleteLineItemModal" tabindex="-1" role="dialog" aria-labelledby="deleteLineItemModal" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body edit-content">
<h5 class="text-center">Are you sure you want to delete this line item? {{$oi->id}}</h5>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger pull-left">Yes, I am sure</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">No, not today</button>
</div>
</div>
</div>
</div>
When user click the delete icon for any record inside the table, it will pop up the modal to ask user if they want to delete selected row of record. How can I solve this problem?
You need to use javascript/jquery to pass values to modal.
{!! Form::open(['method' => 'PATCH','action' => ['OrderController#update',$order_items->id], 'class'=>'table_form']) !!}
#foreach($order_items as $oi)
<tr class="order-form-row">
<td>
{{ $oi->name }}
</td>
<td>
<a data-item="{{ $oi->id }}" class="btn btn-block" data-toggle="modal" data-target="#deleteLineItemModal"><i class="icon-trash"></i></a>
</td>
</tr>
#endforeach
{!! Form::close() !!}
{{--bootstrap modal--}}
<div class="modal fade" id="deleteLineItemModal" tabindex="-1" role="dialog" aria-labelledby="deleteLineItemModal" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body edit-content">
<h5 class="text-center">Are you sure you want to delete this line item? {{$oi->id}}</h5>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger pull-left">Yes, I am sure</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">No, not today</button>
</div>
</div>
</div>
<script>
$(document).on("click", ".btn-block", function () {
var itemid= $(this).attr('data-item');
$("#lineitem").attr("href","/orders/line-item-delete/"+itemid)
});
</script>
I'm building a blog to learn Laravel (5.4.13). In my posts show view I'm looping through all the corresponding post comments. Beside each comment is an edit button and a delete button. For comment editing, I'm attempting to use a modal instead of redirecting to the typical edit view. Currently I'm storing the specific comment data within two data-attributes, and then retrieving those values using jQuery. Then I'm using jQuery again to pass the data into the modal. This is working fine except I'm not sure how to pass the $comment->id into the form route. Any help is much appreciated.
#extends('main')
#section('title', 'View Post')
#section('content')
<div class="row">
<div class="col-md-8">
<h1>{{$post->title}}</h1>
<small>Published: <i class="fa fa-clock-o"></i> {{ $post->created_at->format('M Y, h:i a') }}</small>
<hr class="light-hr">
<p class="lead">{{ str_limit($post->body, $limit = 200, $end = '...') }}</p>
<hr>
<div class="tags">
#foreach($post->tags as $tag)
<span class="label">
{{ $tag->name }}
</span>
#endforeach
</div>
<br>
<br>
{{-- Display comments associated with posts --}}
<h4>Related Posts <i class="fa fa-level-down"></i></h4>
#foreach($post->comments as $comment)
<?php $avatars = array('monsterid', 'identicon', 'wavatar', 'retro'); ?>
<?php $randAvatars = urlencode($avatars[array_rand($avatars)]); ?>
<div class="comments">
<div class="author-info">
<div class="author-img">
<img src={{"https://www.gravatar.com/avatar/".md5(strtolower(trim($comment->email)))."?s=55&d=".$randAvatars}} class="img-circle" alt="user profile image">
</div>
<div class="author-meta">
<b>{{$comment->name}}</b>
made a post.
<h6>Published: <i class="fa fa-clock-o"></i> {{ $comment->created_at->format('M Y, h:i a') }}</h6>
</div>
<div class="comment-controls pull-right">
<button
type="button"
class="btn btn-primary btn-sm fa fa-pencil edit-comment"
data-toggle="modal"
data-comment="{{$comment->comment}}"
data-comment-id="{{$comment->id}}"
data-target="#editComment">
</button>
<button type="button" class="btn btn-danger btn-sm fa fa-trash"></button>
</div>
</div>
<div class="author-comment">
<hr>
<p>{{$comment->comment}}</p>
</div>
</div>
#endforeach
</div>
<div class="col-md-4">
<div class="well">
<dl class="dl-horizontal">
<dt>Created: </dt>
<dd> {{ $post->created_at->format('M jS, Y') }}</dd>
<dd><i class="fa fa-clock-o"></i> {{ $post->created_at->format('h:i:s a') }}</dd>
</dl>
<dl class="dl-horizontal">
<dt>Last Updated: </dt>
<dd>{{ $post->updated_at->format('M jS, Y') }}</dd>
<dd><i class="fa fa-clock-o"></i> {{ $post->updated_at->format('h:i:s a') }}</dd>
</dl>
<dl class="dl-horizontal">
<dt>Post Slug: </dt>
<dd>{{ url('blog/'.$post->slug) }}</dd>
</dl>
<dl class="dl-horizontal">
<dt>Category: </dt>
<dd>{{ $post->category->name }}</a></dd>
</dl>
<hr>
<div class="row">
<div class="col-sm-6">
Edit
</div>
<div class="col-sm-6">
<form action="{{ route('posts.destroy', $post->id) }}" method="POST">
<input type="submit" value="Delete" class="btn btn-danger btn-block">
<input type="hidden" name="_token" value="{{ Session::token() }}">
{{ method_field('DELETE') }}
</form>
</div>
<div class="col-sm-12">
Back to <i class="fa fa-long-arrow-right" aria-hidden="true"></i> Posts
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="editComment" tabindex="-1" role="dialog" aria-labelledby="editCommentLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="editCommentLabel">Edit Comment</h4>
</div>
<div class="modal-body">
<form action="{{route('comments.update', $comment->id)}}" method="POST">
<div class="modal-body">
<div class="form-group">
<textarea name="comment" class="form-control current-comment"></textarea>
<span class="test"></span>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<input type="submit" value="Save Changes" class="btn btn-primary">
<input type="hidden" name="_token" value="{{ Session::token() }}">
{{ method_field('PUT') }}
</div>
</form>
</div>
</div>
</div>
</div>
#section('scripts')
<script>
$('.edit-comment').on('mousedown', function(){
var comment = $(this).attr('data-comment');
var comment_id = $(this).attr('data-comment-id');
$('.current-comment').html(comment);
$('.test').html(comment_id);
});
</script>
#endsection
#endsection
// Comments Routes
Route::post('comments/{id}', ['uses' => 'CommentsController#store', 'as' => 'comments.store']);
Route::put('comments/{id}', ['uses' => 'CommentsController#update', 'as' => 'comments.update']);
You're almost there. I would suggest that you don't need to pass the {id} since you use the [PUT] method to pass the data in your {form}.
We can set a new hidden {input} type inside your {form} (e.g input[name="edit_comment_id"]) and remove the request parameter from the url in your form's {action} attribute.
Like this:
<form action="{{route('comments.update')}}" method="POST" id="update-comment">
<div class="modal-body">
<div class="form-group">
<input type="hidden" name="edit_comment_id" /> //place the {id} in here
<textarea name="comment" class="form-control current-comment"></textarea>
<span class="test"></span>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<input type="submit" value="Save Changes" class="btn btn-primary">
<input type="hidden" name="_token" value="{{ Session::token() }}">
{{ method_field('PUT') }}
</div>
</form>
Then in your {scripts} section:
$('.edit-comment').on('mousedown', function(){
var comment = $(this).attr('data-comment');
var comment_id = $(this).attr('data-comment-id'); // (e.g 12)
var oFormUpdateComment = $('#update-comment'); //add an {id} attribute on your form name 'update-comment' as given above.
oFormUpdateComment.find('input[name="edit_comment_id"]').val(comment_id);
});
And since we didn't pass a request parameter next to the 'comments' url anymore, You will update your [routes.php] like this:
Route::post('comments', ['uses' => 'CommentsController#store', 'as' => 'comments.store']);
Route::put('comments', ['uses' => 'CommentsController#update', 'as' => 'comments.update']);
Then in your [CommentsController], Since you already know how to get those values:
use Illuminate\Support\Facades\Input;
class CommentsController extends Controller
{
protected function store()
{
print_r('<pre>');
var_dump(Input::get('edit_comment_id'));
}
protected function update()
{
print_r('<pre>');
var_dump(Input::all());
}
}
Hope this helps for your case.
I was reluctant to answer this myself but was able to get it to work after rethinking my approach. Instead of trying to alter the blade url in the form somehow, I left the action attribute blank and built the url dynamically when the event fired. So as I did before, I grabbed the data from the data attributes, but instead of trying to alter the blade tag in the form, the url is built and then added to the action attribute. This thread was a great help. I posted my updated code incase it helps anyone.
#extends('main')
#section('title', 'View Post')
#section('content')
<div class="row">
<div class="col-md-8">
<h1>{{$post->title}}</h1>
<small>Published: <i class="fa fa-clock-o"></i> {{ $post->created_at->format('M Y, h:i a') }}</small>
<hr class="light-hr">
<p class="lead">{{ str_limit($post->body, $limit = 200, $end = '...') }}</p>
<hr>
<div class="tags">
#foreach($post->tags as $tag)
<span class="label">
{{ $tag->name }}
</span>
#endforeach
</div>
<br>
<br>
{{-- Display comments associated with posts --}}
<h4>Related Posts <i class="fa fa-level-down"></i></h4>
#foreach($post->comments as $comment)
<?php $avatars = array('monsterid', 'identicon', 'wavatar', 'retro'); ?>
<?php $randAvatars = urlencode($avatars[array_rand($avatars)]); ?>
<div class="comments">
<div class="author-info">
<div class="author-img">
<img src={{"https://www.gravatar.com/avatar/".md5(strtolower(trim($comment->email)))."?s=55&d=".$randAvatars}} class="img-circle" alt="user profile image">
</div>
<div class="author-meta">
<b>{{$comment->name}}</b>
made a post.
<h6>Published: <i class="fa fa-clock-o"></i> {{ $comment->created_at->format('M Y, h:i a') }}</h6>
</div>
<div class="comment-controls pull-right">
{{-- Store comment specific data to built URL for modal --}}
<button
type="button"
class="btn btn-primary btn-sm fa fa-pencil edit-comment"
data-toggle="modal"
data-comment="{{$comment->comment}}"
data-comment-id="{{$comment->id}}"
data-target="#editComment">
</button>
<button type="button" class="btn btn-danger btn-sm fa fa-trash" ></button>
</div>
</div>
<div class="author-comment">
<hr>
<p>{{$comment->comment}}</p>
</div>
</div>
#endforeach
</div>
<div class="col-md-4">
<div class="well">
<dl class="dl-horizontal">
<dt>Created: </dt>
<dd> {{ $post->created_at->format('M jS, Y') }}</dd>
<dd><i class="fa fa-clock-o"></i> {{ $post->created_at->format('h:i:s a') }}</dd>
</dl>
<dl class="dl-horizontal">
<dt>Last Updated: </dt>
<dd>{{ $post->updated_at->format('M jS, Y') }}</dd>
<dd><i class="fa fa-clock-o"></i> {{ $post->updated_at->format('h:i:s a') }}</dd>
</dl>
<dl class="dl-horizontal">
<dt>Post Slug: </dt>
<dd>{{ url('blog/'.$post->slug) }}</dd>
</dl>
<dl class="dl-horizontal">
<dt>Category: </dt>
<dd>{{ $post->category->name }}</a></dd>
</dl>
<hr>
<div class="row">
<div class="col-sm-6">
Edit
</div>
<div class="col-sm-6">
<form action="{{ route('posts.destroy', $post->id) }}" method="POST">
<input type="submit" value="Delete" class="btn btn-danger btn-block">
<input type="hidden" name="_token" value="{{ Session::token() }}">
{{ method_field('DELETE') }}
</form>
</div>
<div class="col-sm-12">
Back to <i class="fa fa-long-arrow-right" aria-hidden="true"></i> Posts
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="editComment" tabindex="-1" role="dialog" aria-labelledby="editCommentLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="editCommentLabel">Edit Comment</h4>
</div>
<div class="modal-body">
<form id="comment-edit-modal" action="" method="POST">
<div class="modal-body">
<div class="form-group">
<textarea name="comment" class="form-control current-comment"></textarea>
<span class="test"></span>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<input type="submit" value="Save Changes" class="btn btn-primary">
<input type="hidden" name="_token" value="{{ Session::token() }}">
{{ method_field('PUT') }}
</div>
</form>
</div>
</div>
</div>
</div>
#section('scripts')
<script>
$('.edit-comment').on('mousedown', function(){
var comment = $(this).attr('data-comment');
$('.current-comment').html(comment);
var comment_id = $(this).attr('data-comment-id');
var form = $('#comment-edit-modal')
// Set current URL
var comment_edit_URL = {!! json_encode(url('/comments')) !!} + '/' + comment_id;
// Append currrent URL
form.attr('action', comment_edit_URL);
});
</script>
#endsection
#endsection
I know this should be something easy but I don't figured out how to do it:
I have multiple "delet" buttons implemented on a datatable, and want to show a modal with the dialog: Do you reall want to delete: , but I don't know how to put the sentence.
This is my View:
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div class="modal-body">
<div id="message">
<h3> BORRAR TIPO </h3>
{{ Form::model($catalog["nambe"], array('method' => 'DELETE', 'id' => 'type', 'route' => array($catalog["name"].'.destroy', $catalog["id"]))) }}
<br>
<p>Do you reall want to delete: {{ //I whant to display the exactly name of that button }} </p>
<br>
{{ Form::submit('Save', array('class' => 'btn btn-danger')) }}
<button type="button" class="btn btn-info" data-dismiss="modal">Cancel</button>
{{ Form::close() }}
</div>
//mode code below
In my DB I have:
name of table |type|
|id |
|name|
And I Want to show the name of the exact type than I press, but don't know how to do it, can someone help me please? Thanks!
This is actually a javascript issue. I've fixed this many times with this:
<div class="modal" id="your-modal">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div class="modal-body">
<div id="message">
<h3> BORRAR TIPO </h3>
{{ Form::model($catalog["nambe"], array('method' => 'DELETE', 'id' => 'type', 'route' => array($catalog["name"].'.destroy', $catalog["id"]))) }}
<br>
<p>Do you reall want to delete: <span id="deleteSentence"></span></p>
<br>
{{ Form::submit('Save', array('class' => 'btn btn-danger')) }}
<button type="button" class="btn btn-info" data-dismiss="modal">Cancel</button>
{{ Form::close() }}
</div>
And with this script you can change the value of the span:
<script>
$('#your-modal').on('show.bs.modal', function (e) {
$('#deleteSentence').html($(e.relatedTarget).data('sentence'));
});
</script>
And then add the invoker button:
<a class="btn" data-toggle="modal" data-sentence="{{$name}}" data-target="#your-modal" href="http://some-url" >Launch Modal</a>
If you wan't to send the name with you're form then put a hidden input field in the modal.