0

I have an a tag that has href="/test". This sends me to my routes page and goes to a controller and everything works. What I am wondering is if there is a way to attach a variable to /test that is from a html input tag the user inserted data into. For example I will have an input

<input type="text" class="form-control" name="number" id="number" placeholder="e.g. 1">

and I want my href to be href="/test/" number

2
  • Possible duplicate of Laravel Queries Strings Commented Sep 13, 2017 at 18:00
  • @Spartacus ; it's reversed as given. Commented Sep 13, 2017 at 18:06

1 Answer 1

2

Use javascript for this at onsubmit or call any function on button click . And inside function use below code

 var number = 1;// Get value here from text box as $("#number").val();
 location.href ="/test/"+number;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.