Submit Buttons

Status
Not open for further replies.

pcbres12

Baseband Member
Messages
34
What is the code for a submit button for like a quiz or a poll or information. And where does the info get sent when it's submitted?
 
If you're talking about a web form or something, you can't make a button with Javascript. You make the button with html, like this:

Code:
<form action="" method="">
<input type="submit" name="submit" value="submit" />
</form>

Action is the script that will process the form is located, and method is either GET or POST. Get is sent via the URL, POST is not.

Now, Javascript can process the script as you use it, or before you submit it. If you want compatibility and any security whatsoever, you'll want a scripting language or CGI like PHP, Perl, Python etc to handle the form.
 
By the action in the <form>.

For example;

Code:
<form action="test.php" method="post">
<input type="text" name="name" /><br />
<input type="text" name="email" /><br />
<input type="submit" name="submit" value="submit" />
</form>

Then test.php:

Code:
<?php

$name = $_POST['name'];
$email = $_POST['email'];

echo $name.'<br />'.$email;

?>
 
Status
Not open for further replies.
Back
Top Bottom