Click to See Complete Forum and Search --> : I need a Form


sylviastarlight
05-10-2005, 07:00 AM
I want to add a simple form to a webpage...
with boxes for the person's name, e-mail, website title and website URL...

The problem is that I don't know Javascript, and I can't find a site that would make a form... I tried Bravenet, but I can't seem to edit the form... :confused: it's too complicated.

Can anyone suggst a site where I can get a form easily ?

scragar
05-10-2005, 07:08 AM
<form action="PAGE TO SEND FORM TO" method="post">
name: <input type="text" name="usersName" value="DEFAULT VALUE"><br>
password: <input type="password" name="usersPassword" value=""><br>
big text: <textarea name="bigbox">DEFAULT VALUE</textarea>
<input type="submit" value="SUBMIT now">
<input type="reset" value="Reset the form">
</form>

buntine
05-10-2005, 10:53 AM
Note, you don't need JavaScript to create a form. Thats what HTML is for. ;)

Samuel2816
05-10-2005, 02:59 PM
your also going to need a script to process the form. either form to email or form to db.. to do this you will need a server side : php, ColdFusion, ASP, .NET, JSP or a CGI script. you point your form action to point to this page/script. this will depend on what your server supports. Once you find out what your server supports use a search engine to find a free script form to mail or whatever.


<input type="text" name="usersName" value="default_value"> use this line as posted he posted above to generate the differnt feilds he did not post.. example
:
<input type="text" name="sitetitle" value="default_value">
<input type="text" name="siteurl" value="default_value">
<input type="text" name="email" value="default_value">

now if you want form validation so someone does not send you a false email or whatever, and you want some of the feilds required.. you can use javascript(client side) or a server side script for this.

you asked were you can get a form easy... You want to check your server first for this as thay probably have some sort of form processing script already in place.

sylviastarlight
05-12-2005, 09:21 AM
What's a javascript(client side) or a server side script ?

scragar
05-12-2005, 09:23 AM
javascript is run on the users computer to validate that things are valid.

a server side language would be used to confirm this and do any emailing or whatever it is you want to do with it.

buntine
05-12-2005, 09:46 AM
Obviously, Scrager is pointing out the use of the two concepts in the context of this problem. Each has quite substantial functionality.

Wikipedia definition for client-side: http://www.webopedia.com/TERM/c/client_side.html
Wikipedia definition for server-side: http://en.wikipedia.org/wiki/Server-side


Regards.

sylviastarlight
05-13-2005, 02:06 AM
QUESTION 1

<form action="PAGE TO SEND FORM TO" method="post">

in the place of "PAGE TO SEND FORM TO" is it just enough to tpe the URL of that page ?

QUESTION 1
What do I put if I want the results to be e-mailed to me ?

buntine
05-13-2005, 02:50 AM
in the place of "PAGE TO SEND FORM TO" is it just enough to tpe the URL of that page ?

Yes. Why not just try it? Trial and Error....

What do I put if I want the results to be e-mailed to me ?

The URL of a server-side script that formats and sends the data to your inbox. Not the mailto: command.

Regards.

sylviastarlight
05-20-2005, 09:16 AM
Yes. Why not just try it? Trial and Error....



Ok, that didn't work. So what do I do ?

Sanim
05-20-2005, 10:28 AM
Make a page and save it as contact.php
Here's the code for contact.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Email Form </title>
</head>
<body>

<form method="post" action="sendmail.php">

<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />


Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />
Your Email:<br />
<input type="text" name="visitormail" size="35" />
<br /> <br />
Copy Sender ? No<input name="ccopy" type="radio" value="ccno" /> Yes<input checked="checked" name="ccopy" type="radio" value="ccyes" /> <br />

<br />
Attention:<br />
<select name="attn" size="1">
<option value=" Sales n Billing ">Sales n Billing </option>
<option value=" General Support ">General Support </option>
<option value=" Technical Support ">Technical Support </option>
<option value=" Webmaster ">Webmaster </option>
</select>
<br /><br />
Mail Message:
<br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send" />
</form>
</body>
</html>

Next, make a page called sendmail.php in the same directory as conact.php
Here's sendmail.php's code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sendemail Script</title>
</head>
<body>

<!-- Required: YOUR email ($myemail). Optional: Enter CC email address ($ccx)
Required: Add the link for the 'next page' (at the bottom) -->

<?php
$myemail = "your_email_herel";
$ccx = "your_second_email_here_optional";

if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
}
echo $badinput;

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn . "(" . $ccopy . ")" ;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";

if (($ccopy == "ccyes") && ($visitormail != ""))
mail($visitormail, $subject, $message, $from);

if ($myemail != "")
mail($myemail, $subject, $message, $from);

if ($ccx != "")
mail($ccx, $subject, $message, $from);

?>

<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />

Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $ip ?>
</body>
</html>

sylviastarlight
05-29-2005, 03:43 AM
Err.... I don't know a thing about php...
well, I did this. Semms to work. Thanks !

One question: what does "copy sender" mean ?

sylviastarlight
05-29-2005, 03:47 AM
Another question:

Suppose I want the form to have fields like
'your website URL' and 'website description', is it enough to make another Your Name:

textarea like the 'Mail Message' one ?

Sanim
05-29-2005, 10:12 AM
Sorta like that, but then you'd have to mess around with the PHP, and that can get really tricky.. Ask a PHP pro :P There are plenty of them here.