Upload html form data on server with php
Upload html form data on server with php easily.
Hello guys welcome to our blog. Today we disscus about the html form data to upload on server with very simple and easy method with the help of php's very short code. Lets start now!
Guys i hope that all of you know to create a simple html form with input of name, adress, mobile number, etc but near about 80% beginner student don't know that how save these data which user input in the form field.
We also know that about the form method which use in the form tag 'get' or 'post'. Here we use only post method to write costumer input on the server in txt file.
For this complete action we must have a php file which url use in the action.
First we have create a form in html.
Simple code shown of a html below.
First we have create a form in html.
Simple code shown of a html below.
<!DOCTYPE html>
<head>
</head>
<body>
<form method="post" action="submit.php" >
<input type="text" name="name" value="" />
<input type="text" name="adress" value="" />
<input type="submit" value="submit" />
</form>
</body>
</html>
<head>
</head>
<body>
<form method="post" action="submit.php" >
<input type="text" name="name" value="" />
<input type="text" name="adress" value="" />
<input type="submit" value="submit" />
</form>
</body>
</html>
In this code you can note that here i use submit.php on action we have crate a php file to write the data on server.
Watch this video for more information
This php code is shown below.
<?php
$name=$_POST["name"];
$adress=$_POST["adress"];
?>
<?php
$file=fopen("formdata.txt", "a");
fwrite($file,$name);
fwrite($file,$adress);
fclose($file);
?>
$name=$_POST["name"];
$adress=$_POST["adress"];
?>
<?php
$file=fopen("formdata.txt", "a");
fwrite($file,$name);
fwrite($file,$adress);
fclose($file);
?>

Goof
ReplyDeleteCool
ReplyDelete