+ 17
How to I submit data of my html program?
I have created "Student Info Form.html", which takes student info such as FName, rollNo, fees, mobile no. How to store its contents?
33 Respostas
+ 28
index.html
<form action="processdata.php" method="post">
<input type="text" name="info">
<button type="submit">Send data</button>
</form>
processdata.php
// get the data
$info = filter_input(INPUT_POST, 'info', FILTER_SANITIZE_SPECIAL_CHARS);
// db connection
$host = "localhost";
$dbname = "test";
$user = "root";
$pass = "password";
$conn = new PDO("mysql:host=$host;dbname=$dbname","$user","$pass");
// statement
$stmt = $conn->prepare("INSERT INTO test (column_name) VALUES (?)");
$stmt->bind_param("s", $info);
$stmt->execute();
+ 16
If a local server is installed on your phone then yes. You need something like https://play.google.com/store/apps/details?id=ru.kslabs.ksweb on android
+ 15
awesome guysš, but one more thing I wanna to know, will it work on phone or only PC?
+ 15
to avoid mess in your database, limit user's freedom in text inputs as much as possible.
Prefere select, raddio buttons, check boxes and limit to the minimum text areas as you may end up wondering how twisted is human fantasy when it comes to simple form filling.
If text areas are indispensable like for name or email ecc... you can use regular expressions to evaluate the type of input enterd before submitting:
for example you'd like to avoid user to enter numbers and special char in their name input;
or you may want to define a pattern for the email input that expects text separated by at least an @ and a . chars without illegal chars.
There is a very comprehensive tutorial about that on w3schools named php form input.
consider this your primary filtering.
People fantasy can mess up the standard you have in mind to manage the data on your db.
after that, follow @Patrik Sokol instruction to avoid the risk of sql injection in your db.
Setting up the server in your school to be accessible from the internet may involve port forwarding and firewall exeption that are intrinsic security flaws.
you may want to consider an online hosting service. A free one that has what you need (http-php-sql) is 000webhost.com.
Whatever option you chose, any(one) student will be able to connect to the web interface using a browser.
+ 11
good joke @Leonš
+ 10
@Isaac Adavize
thank you for idea, I'm trying it now
+ 9
Database.... U shud have one.... For now use wamp server
+ 8
Big +1 for seamiki!
+ 8
you need to create a processing script in php/asp/jsp or as you choice . then submit the data to the script by the Action attribute in form element of HTML.
it looks like
<form action ="check.php">
+ 7
To collect data set a database.
+ 6
use <form action="filename.php" method="post" >...</form> where filename.php is the name of the file where you will process the form data. in this file extract the data using the superglobal $_POST. e.g to get FName use $_POST["FName"] and assign it to a variable that you can save.
+ 5
you need local server such as xampp or wamp and create database then create a table that will store input in the form you have created, search validate form register in w3school.com for tutorial
+ 4
you need to create a processing script in php/asp/jsp or as you choice . then submit the data to the script by the Action attribute in form element of HTML.
it looks like
<form action ="check.php">
+ 3
how can i learn every thing on html
+ 3
<form action="executor.php" method="post">
take your form and button <input type="submit" value="submit"/>
close the form with </form>
+ 3
@Negadi, you can start by taking the HTML course, understand the basics, then progress to the more advance concepts
+ 3
@Ajay, if you want to test your form page on your phone, you can install mobile applications like Palapa Web Server (PWS). It's a very cool app for devolopers
+ 3
Post it to letterbox hahaha
+ 3
you need a server side scripting language & connectivity to a database server like MySql & then go for scripting queries & connectivity queries
+ 2
you may use form action and also submit button