How to set different url into <form>, using parameter - html

I want to call different controllers, depending on start parameter:
(parameter start is boolean)
I am try to implement this task, using thymeleaf framework, but in this case him not working:
<div class="w3-container" align="center">
<input class="w3-input w3-border" name="competition" type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for competitions.." title="Type in a competition name">
<form th:if="${start}" action="/challenger" method="post">
<form th:if="${!start}" action="/competition" method="post">
.............
........
<input class="w3-button" type="submit" value="Go"/>
</form>
</form>
</div>
How to accomplish this task in my case?

Related

post not send form data

I have a problem with sending posts in codeigniter, reading other posts I set the variable max_input_vars = 1000. but does not send the data.
the resulting in html is:
<form id="0" action="CO_controller" method="post">
<input id="idric_0" value="0.02508800 154401490122">
<input id="name_0" value="val0">
<input id="per_0" value="10">
<input id="unit_0" value="g">
<input id="ric_0" value="0.02508800 1544014901">
<input id="command0">
<input id="mod0" type="submit" value="Modific" onclick="document.getElementById('command0').value = 'modific';">
<input id="eli0" type="submit" value="Deleta" onclick="document.getElementById('command0').value = 'deleta';">
<input id="id_sal0" value="0.02508800 1544014901">
</form>
<form id="1" action="CO_controller" method="post">
<input id="idric_1" value="0.02508800 154401490122">
<input id="name_1" value="val0">
<input id="per_1" value="10">
<input id="unit_1" value="g">
<input id="ric_1" value="0.02508800 1544014901">
<input id="command1">
<input id="mod1" type="submit" value="Modific" onclick="document.getElementById('command1').value = 'modific';">
<input id="eli1" type="submit" value="Deleta" onclick="document.getElementById('command1').value = 'deleta';">
<input id="id_sal1" value="0.02508800 1544014901">
</form>
the operation is correct ie when I click the button, set the value of the command and submit.
in debug, I go to see the variable $ _POST and it is empty
As said in the comment, you should use name instead of id. By using id you are not passing the values correctly.
Unless you have a route defined so that CO_controller points to a method (and not just a controller) this is not going to work:
<form id="0" action="CO_controller" method="post">
Your form action should point directly to the method within the CO_controller controller which will process the form input.
Assuming the method within the controller is called process_form your form should point to:
<form id="0" action="CO_controller/process_form" method="post">
give it a go and let us know how it works

Retrieving POST form input using Dart

I am using IIS, so I need to avoid using port numbers. I have this index.html...
<body>
<div id="output"></div>
<p> </p>
<form action="verify.html" method="post">
<div>First name: <input type="text" name="first_name" required=""></div>
<div>Last name: <input type="text" name="last_name" required=""></div>
<div><input type="submit" value="Add Name"></div>
</form>
</body>
All I want to do right now is display the user's input on verify.html. I wired a "verify.dart" to verify.html. I know that input can be retrieved in PHP 7 using
$firstName = filter_input(INPUT_POST, 'first_name');
Is there an analog to that code in the Dart SDK?

How my website submit email to my email using submit button for inquiry

This is the code of my website
<form class="form">
<input class="name" type="text" placeholder="Name">
<input class="email" type="email" placeholder="Email">
<input class="phone" type="text" placeholder="Phone No:">
<textarea class="message" name="message" id="message" cols="30" rows="10" placeholder="Message"></textarea>
<input class="submit-btn" type="submit" value="SUBMIT">
</form>
<form class="form" action="emailSubmit.php" method="POST">
You can also add a function to return true or false for validating input data
<form class="form" action="emailSubmit.php method="POST" onsubmit="return validateData()">
When submit is pressed, validate data returns true if input valid and send data through POST to php file, false if invalid and does nothing
Ofcourse this goes along with javascript functions, php script and database to insert queries to

HTML label control doesn't pass form data to controller

This format of html form control doesn't pass form data
<form action="index.php?action=createNewCustomer"
method="POST">
<fieldset>
<label class="field" for="firstName">First Name:</label>
<input type="text">
</fieldset>
<input type="submit">
</form>
but this one does
<form action="index.php?action=createNewCustomer"
method="POST">
<fieldset>
<label>First Name:</label>
<input type="text" name="firstName">
</fieldset>
<input type="submit">
</form>
Unless I'm missing something obvious, the difference is in the label control..Are both valid and if so, can anyone explain to me why only the second one passes form data to my PHP controller method.
<input type ="submit"> is not part of the fieldset in the first bit of code, but I don't think that's really the issue.
I believe changing the code on the first bit to:
<form action="index.php?action=createNewCustomer"
method="POST">
<fieldset>
<label for = "firstName">First Name: </label>
<input type="text" name = "firstName">
<input type="submit">
</fieldset>
</form>
will work. You need to make sure the name of the input is the same as the property you are trying to set.

Passing parameter and user input

I am trying to pass a few parameter and a user input to a search_form.asp page.
<form action="search_form.asp" method="Post">
<input type="text"name="fname"/></th>
<input type="submit" value="Update">
</form>
And on search_form.asp...
lname=request.QueryString("Lname")
fname=request.form("fname")
But I am unable to see lname when i place Response.Write("<p>Name: " & lname) in search_form.asp
The query string is not preserved when you submit the form, so search_form.asp will not have a query string. As an alternative, could you include the query string as a hidden field:
<form action="search_form.asp" method="Post">
<input type="text"name="fname"/></th>
<input type="submit" value="Update">
<input type="hidden" name="lname" value="<%=Request.QueryString("lname")%>" />
</form>
And then refer to Request.Form("lname") in search_form.asp.
Alternatively, could you include the query string in the form action?
<form action="search_form.asp?<%=Request.ServerVariables("QUERY_STRING")%>" method="Post">
<input type="text"name="fname"/></th>
<input type="submit" value="Update">
<input type="hidden" name="lname" value="<%=Request.QueryString("lname")%>" />
</form>
This should pass the query string on the original page when the form is submitted.