Send Form Data To Server And Store It In The Server Using Java Script
I have a form page and I would like to submit the form details to my server, and store the details within the server. I need a script to send the client's request to the server and
Solution 1:
JavaScript is a client-side scripting language, it can not store anything on your server as you will need a server-side scripting language.
The first part of drawing a form and asking the user for the data is easy and can be done in HTML, and some jQuery if you would like it nice looking. The server-side will require a PHP/ASP script that will store or send the submitted data.
Example:
HTML (form.html):
<formmethod="POST"action="store.php">
Enter Your Name: <inputtype="text"name="fullname" /></form>
PHP (store.php):
<?phpforeach($_POSTas$name=>$value)
{
$contents .= "$name = $value" . "\n";
}
// save locally in cache folder$fd = fopen("cache/filename.txt", "w");
fwrite($fd, $contents);
fclose($fd);
// mail me the submitted data
@mail("me@there.com", "some subject", $contents);
// die in piecedie();
?>
Post a Comment for "Send Form Data To Server And Store It In The Server Using Java Script"