I have a form which have name, email and phone. But i want current page title or url when user submit the form, Because I want to track the user page. Please let me know How i can do it. This is my form code.
<form class="callus" method="post" action=""> @csrf <div class="col-md-3 col-sm-6"> <div class="single-query form-group"> <input type="hidden" name="product_title" value="" class="keyword-input" placeholder="Enter Your Name" required=""> </div> </div> <div class="col-md-3 col-sm-6"> <div class="single-query form-group"> <input type="text" name="user_name" class="keyword-input" placeholder="Enter Your Name" required=""> </div> </div> <div class="col-md-3 col-sm-6"> <div class="single-query form-group"> <input type="text" name="user_email" class="keyword-input" placeholder="Enter Your Email" required=""> </div> </div> <div class="col-md-3 col-sm-6"> <div class="single-query form-group"> <input type="text" name="user_phone" class="keyword-input" placeholder="Enter Your Phone" required="Field is required"> </div> </div> <div class="col-md-3 col-sm-6"> <div class="single-query form-group"> <input type="submit" value="submit now" class="btn-blue"> </div> </div> </form>
This is my Email send code...
public function sendyourmail(Request $r)
{
$validator = Validator::make($r->all(), [
'user_name' => 'required',
'user_email' =>'required',
'user_phone' =>'required',
'user_desc' =>'required',
]);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator);
}
$data=[
'user_email'=>$r->user_email,
'user_name'=>$r->user_name,
'user_phone'=>$r->user_phone,
'user_desc'=>$r->user_desc,
];
Mail::send('mail', $data, function($message) use($data)
{
$message->from($data['user_email'], 'Email Form Sumit');
$message->to('sumit@gmail.com')->cc('sumit@sumit.com');
$message->subject($data['user_desc']);
});
return redirect()->back()->with('message','Your Mail Has Been sent Successfully, We Will Get Back to You Shortly.');
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire