Status
Not open for further replies.

splashIT.net

New Member
hi all..


they have puzzeled me for long enough.. and now i want to learn...

i have a few q's.

1. how do i set up a form... well i use dreamweaver and front page
2. what do i have to type into the code
3. what do i submit the stuff that people fill in to. (ie. to an email address or to a text file .txt or something else)
4. if i was using a form for a links page how do i get the results to appear on the site?

many thanks to anyone who can help
 

louie

New Member
you are missing the most important part.
what language do you use asp or php?

forget about frontpage stick with dreamweaver.
both of them has the capabilities of helping you creating the form itself.

for the last question we need an answer to the first question i asked.
on both language you can use the request mode depending on the setup of the form post or get.

you need to decide what you want to do with the form itself - email it or save to a database or probably a text file(don't see the point in that)
 

splashIT.net

New Member
php all the way as i am on a linux server.

secondly i am totally new to this so i dont mind weather i use a database txt file for email..

i just want to make a working form first of all.. start with something basic to practice and then slowly develop it
 

louie

New Member
forms are the most complicated thing cause they need to be checked and rechecked especially if you do an insert in the database.
using the post method you can get the field value in php by using
<?php @$HTTP_POST_VARS['youformfieldname'];?>

if using get (not recommend it)
<?php @$HTTP_GET_VARS['youformfieldname'];?>

hope this help
 

splashIT.net

New Member
HTML:
<body>
<?php @$HTTP_POST_VARS['feedback.txt'];?>
  <p>
    <input type="text" name="textfield">
  </p>
  <p> 
    <textarea name="textarea"></textarea>
  </p>
  <p>
    <input type="submit" name="Submit" value="Submit">
  </p>
</form>
</body>
</html>


is that it??? sorry i am very at see with these forms!
 

mneylon

Administrator
Staff member
What are you going to use the forms for?
Is it to gather information?
A replacement for a mailto: link?
 

louie

New Member
you can not asle for a text file from you form but a textfield by name or id.
Code:
[LEFT][COLOR=#000080]<body>[/COLOR][/LEFT]
[COLOR=#000080]<?php @$HTTP_POST_VARS['[COLOR=#0000ff]textfield[/COLOR]'];?>[/COLOR]
[COLOR=#000080]<form method="post" action="" name="form1">[/COLOR]
  [COLOR=#000080]<p>[/COLOR]
    [COLOR=#ff8000]<input type=[COLOR=#0000ff]"text"[/COLOR] name=[COLOR=#0000ff]"textfield" value="[COLOR=#000080]<?php echo @$HTTP_POST_VARS['[/COLOR][COLOR=#0000ff]textfield[/COLOR][/COLOR][COLOR=#000080]'];?>"[/COLOR]>[/COLOR]
  [COLOR=#000080]</p>[/COLOR]
  [COLOR=#000080]<p>[/COLOR] 
    [COLOR=#ff8000]<textarea name=[COLOR=#0000ff]"textarea"[/COLOR]>[/COLOR][COLOR=#ff8000]</textarea>[/COLOR]
  [COLOR=#000080]</p>[/COLOR]
  [COLOR=#000080]<p>[/COLOR]
    [COLOR=#ff8000]<input type=[COLOR=#0000ff]"submit"[/COLOR] name=[COLOR=#0000ff]"Submit"[/COLOR] value=[COLOR=#0000ff]"Submit"[/COLOR]>[/COLOR]
  [COLOR=#000080]</p>[/COLOR]
[COLOR=#ff8000]</form>[/COLOR]
[COLOR=#000080]</body>[/COLOR]
[COLOR=#000080]</html>[/COLOR]
 

splashIT.net

New Member
blacknight said:
What are you going to use the forms for?
Is it to gather information?
A replacement for a mailto: link?

initially yes but i have never successfully used forms so i just want to get one to work and then try and slowly develop it to such an extent that i can make forms to add stuff to websites. Similar to php nuke websites or forums and the like.
 

splashIT.net

New Member
so is there anyone that would be so kind as to make a small bit of code for a email feedback form and what to do to get it to work.

name:
email:
subject:
feedback:

thats it.

many many thanks
 

louie

New Member
Code:
<?
// ------------- CONFIGURABLE SECTION ------------------------
// $mailto - set to the email address you want the form
// sent to, eg
//$mailto  = "[EMAIL="youremailaddress@example.com"]youremailaddress@example.com[/EMAIL]" ;
$mailto = [EMAIL="'youemailaddress@server.com'"]'youemailaddress@server.com'[/EMAIL] ;
// $subject - set to the Subject line of the email, eg
//$subject = "Feedback Form" ;
$subject = "Feedback Form" ;
// the pages to be displayed, eg
//$formurl  = "[URL="http://www.example.com/feedback.html"]http://www.example.com/feedback.html[/URL]" ;
//$errorurl  = "[URL="http://www.example.com/error.html"]http://www.example.com/error.html[/URL]" ;
//$thankyouurl = "[URL="http://www.example.com/thankyou.html"]http://www.example.com/thankyou.html[/URL]" ;
$formurl = "[URL="http://yourwebsite.com"]http://yourwebsite.com[/URL]" ;
$errorurl = "[URL="http://yourerrorpage.com"]http://yourerrorpage.com[/URL]" ;
$thankyouurl = "[URL="http://youtThankyoupage.com"]http://youtThankyoupage.com[/URL]" ;
$uself = 1;
// -------------------- END OF CONFIGURABLE SECTION ---------------
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email'])) {
 header( "Location: $formurl" );
 exit ;
}
if (empty($name) || empty($email) || empty($comments)) {
   header( "Location: $errorurl" );
   exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
 header( "Location: $errorurl" );
 exit ;
}
if (get_magic_quotes_gpc()) {
 $comments = stripslashes( $comments );
}
$messageproper =
 "This message was sent from:\n" .
 "$http_referrer\n" .
 "------------------------------------------------------------\n" .
 "Name of sender: $name\n" .
 "Email of sender: $email\n" .
 "------------------------- COMMENTS -------------------------\n\n" .
 $comments .
 "\n\n------------------------------------------------------------\n" ;
mail($mailto, $subject, $messageproper,
 "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
header( "Location: $thankyouurl" );
exit ;
?>
<form action="feedback.php" method="post">
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form">
<tr><td>Name:</td><td><input type="text" name="name" size="25" /></td></tr>
<tr><td>Email address:</td><td><input type="text" name="email" size="25" /></td></tr>
<tr>
<td colspan="2">
Comments<br />
<textarea rows="15" cols="45" name="comments"></textarea>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" value="Send Feedback" /><br />
</td>
</tr>
</table>
</form>
 
Status
Not open for further replies.
Top