I want to make a simple HTML webpage and use a form on that page to upload an object to my server on parse.com
For example, if this is my form:
<form>
First name: <input type="text" name="firstname"><br>
Last name: <input type="text" name="lastname">
</form>
Then I assume I would want some kind of post request, but I don't know how to set that part up with Parse.
Thanks in advance.
You need to do this using the REST API at Parse. You should find all the info you need in the guide:
https://www.parse.com/docs/rest
The form should have the following arguments:
<form action="some_page.php" method="get">
using get will show the sent data from inputs in the url, post will hide.
See this tutorial for more information about forms http://www.w3schools.com/php/php_forms.asp
Related
i assume this is a noob question, so sorry.
I'm trying to write this HTML-Page with a "form" that will work like a link on my raspberry pi.
So I used this code:
<form action="http://192.168.178.62/graph.pl?type=week">
<input type="submit" value="Blah" />
</form>
But instead of ending up at the adress I wrote in the code, I end up here: http://192.168.178.62/graph.pl? ("type=week" is missing, its just cut off)
Why is that, and how can I fix it?
thanks a lot!
When you submit a form with method="GET" (which is the default) then a new query string will be generated from the names and values of the successful form controls (since you don't have any, it will be empty). The new (empty) query string will replace the one in the action.
Options:
Use a link. (This is the best option. You aren't collecting any data from the user. You aren't making a POST request).
Move the data from the action to <input type="hidden" ...> elements.
there is a small and simple example.
I want to check if the data is in the server (for instance if the person is signed). If it is in the server, I know I can res.redirect in express to move on, but if it doesn't, how do I get the response from the server in the html, and not with angular or so, for example pop up a message if he isn't recognized in the db.
<form action="/IsSIgn" method="POST">
<input type="text" name="name">
<button type="submit">sign in</button>
</form>
Solution 1:
res.send("<script>window.alert('unauthorized');</script>")
res.send("<script>window.alert('unauthorized');window.location.href='/example-page-route'</script>")
Solution 2:
Make another html page for invalid name
and redirect to, that page
I have some HTML forms and I need to provide additional parameters which the user will not fill up in the form UI. I understand I can do it using query parameters or hidden form fields. Examples :
a form whose data must be submitted to the server together with an option chosen in the previous web page
Ex: URL /createImage?option=option_value (accessible via GET by user) would contain the HTML code below
Query parameter
<form action='/createImage?option=option_value'>
<input type='textfield1' name='var1'>
</form>
Hidden field
<form action='/createImage'>
<input type='hidden' name='option' value='option_value'>
<input type='textfield1' name='var1'>
</form>
(in this case, I suppose a third solution would be to use a HTTP session variable instead)
a fake form used to associate a POST HTTP request with a image.
Query parameter
<form action='/createContainer?image=image1'>
<input type='image' src='container.png'>
</form>
Hidden field
<form action='/createContainer'>
<input type='hidden' name='image' value='image1'>
<input type='image' src='container.png'>
</form>
(in this case, I suppose a third solution would be to use a standard img HTML tag and use Javascript to send the POST request to the server on its click() event)
Are there any upsides/downsides in each one of those approaches or is it just a matter of personal preference?
So, i'm developing a form that will be checked by a program to be executed with the data. How do you dump the data into a .json file with html forms or any other language?
For sake of the project i'll give a section of the html form to help understand.
<form action="/folder/data.php" method="post">
<div>
<label for="firstname">First Name:</label>
<input type="text" id="firstname" name="firstname">
</div>
<div class="button">
<button type="submit">Sumbit!</button>
</div>
</form>
In my (limited) experience, "action" in the links to a PHP file to process the submitted form fields, like so: Insert input data from HTML form into JSON object and then store it in MYSQL).
Basically, you'll be converting your input fields into a JSON object with 'json_encode' (for PHP) or something similar.
You may want to check out this question: How to send a JSON object using html form data
Basic question. If I have a form in my HTML (where in my case someone inputs a date), how can I have my users cause a GET request with the contents of that form instead of a POST.
e.g. form entry (e.g date)... so 20190312
what I am trying to achieve is such that AFTER the user submits the form.. the user is the lead to page that has
GET domain.tld/scriptname.php?variable=20190312
and then the system then processes the GET request accordingly.
thank you
Maybe i'm missunderstanding what you are asking.
This can easly be achived using builtin GET method in FORM tag
<body>
<form id="form" method="GET" action="scriptname.php">
<input id="date-txt" type="text" name="date">
<input id="search-btn" type="submit" value="Submit">
</form>
</body>
While filling up above field ad clicking "Submit" form will be submitted and you can see in your url path/or/page/scriptname.php?date=INPUT_FIELD_VAL
for every input in #form with a name, if GET method is used, you'll see a ?name=value in the url
What you describe is the default behaviour of a form. If you don't want a POST request, then don't use a method attribute to set the request type to POST.
<form action="//domain.tld/scriptname.php">
<input name="variable" value="20190312">
<button>Submit</button>
</form>