2016-03-08 14:56


  • laravel
  • php
  • html
  • mysql

I am currently able to write data to mysql when one of my pages loads. Here is the code for this in my controller.

public function manuelSignUP()
DB :: table("users") -> insertGetId
array("firstname" => "John", "lastname"=> "John",
"passwordHash" => "password", "userslevelID" => 2)

DB :: table("userlevel") -> insertGetID

array("userlevelID" => $userlevelID, "name" => $name)

 return view("pages.manualsignup");

So I would like to call this function through my blade file on a button click, but I have been struggling to do so. Here is my blade file with the button.

<!DOCTYPE html>
<head> </head>

<body> This should  </body>
<form method="post">
<button type="button"> submit </button>

Based on google searching I know that I can use ajax to help me with this problem, but I believe there is way to do it by just using html post methods. I am trying to do it the second way, without ajax.

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享