-
If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.
Register Today on DNForum IT'S FREE!I have a contact page (basic CGI form) and I'd like to make some of the fields required.
This is the section for email (one I'd like to make required).
I also have a form.php file that the information is sent to (via the "submit" button) - I'm assuming the required fields part should be put in there?Code:Email: <input type="text" name="email" size="47">
Save the wolves - join The Wolf Army today!
Please follow the rules or suffer the wrath of Thor's Hammer.
-
Last edited by amplify; 02-12-2010 at 09:38 PM.
I'm assuming that code goes into the form.php?
Save the wolves - join The Wolf Army today!
Please follow the rules or suffer the wrath of Thor's Hammer.
-
Last edited by amplify; 02-12-2010 at 09:39 PM.
Say your submit button is named 'submit':
PS: you can keep all the stuff in a single page, that calls itself:PHP Code:if (isset($_POST['submit'])) { // submit button was pressed
if empty($_POST['email'])) {
echo 'Error: E-mail is empty:'
} else { // perform further validation on the E-mail address: regex etc...
...
}
}
PHP Code:<?php
if (isset($_POST['submit'])) { // submit button was pressed
if empty($_POST['email'])) {
echo 'Error: E-mail is empty:'
} else { // perform further validation on the E-mail address: regex etc...
...
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
</head>
<body>
<div id="wrapper">
<form action="test.php">
<input type="text" name="email" size="47" maxlength="47" />
<input type="submit" name="submit" value="Send" />
</form>
</div>
</body>
</html>
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
TY Kate - The form is in a WP page, too. Sadly, the "same page" code isn't working (the code itself shows up). I'll have to wait until I get home to see if I can eddit the form.php file.
Save the wolves - join The Wolf Army today!
Please follow the rules or suffer the wrath of Thor's Hammer.
Bookmarks