form help

This is a discussion on "form help" within the Web Page Design section. This forum, and the thread "form help are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Mar 2nd, 2006, 19:24
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
form help

hey there, got a problem with a form, it aall works, but in the email i receive from feedback, the form details are in a line one after the other, any chance i can make line by line in the email, i.e.

First name john:
Last Name: smith
feedback: need help


etc

cheers
skyfire
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Mar 2nd, 2006, 19:33
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 382
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

Hi skyfire,
are you using php to send the form?? If so you'll need the "\n" to put the next field on a new line. Put your code in a reply but make sure you use the <code> tags, and then we can get to the bottom of the problem!

Craig
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Mar 2nd, 2006, 19:33
Junior Member
Join Date: Mar 2006
Location: Munich
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

Oh sorry Craig, I just saw the post when I submitted exactly the same answer Plz post the code of the processing script which, probably visible in the "action" part of the <form>-tag
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Mar 2nd, 2006, 19:44
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

i am using html and css, ive pasted the code below:
Code: Select all
<body background="background.jpg" STYLE="background-repeat: no-repeat; background-attachment: scroll">

<div align="center">
<div align="center">
  <p><img src="logo/logo.gif" width="236" height="212">
      
    <br>
    <br>
    <br>
    <br>
      <a class="head" href="index.htm">Home</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="about.htm">About Us</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="baskets.htm">Baskets</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="contact.htm">Get in Touch..</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="order.htm">Ordering Online?</a>  <br>
     
      <br>
      <br>
      <span class="style10"><br>
  If you would like to get in touch with any questions,</span></p>
  <p class="style10"> please simply fill out the form below, and we will get back to you as soon as possible, </p>
  <p class="style10">or contact us using any of our other contact details,</p>
  <p class="style13">Office: (01224) 480923</p>
  <p class="style13">Mobile: 07706808076</p>
  <p class="style13">Email: claire@heavenlybaskets.co.uk</p>
</div>
<form method="post" action="mailto:you@yourdomain.com">
<INPUT TYPE="hidden" NAME="recipient" VALUE="claire@heavenybaskets.co.uk">
<INPUT TYPE="hidden" NAME="subject" VALUE="Heavenly Baskets Order Form">

<div id="script">
  
<div align="center">
  <legend>Personal Information</legend>
</div>
<table align="center">
<td>
   <p align="center"><label for="first name">First Name: <input type="text" name="firstname" id="firstname" /></label></p>
   <p align="center"><label for="last name">Last Name: <input type="text" name="lastname" id="lastname" /></label></p>
   <p align="center"><label for="email">Your E-mail: <input type="text" name="email" id="email" /></label></p>
</td>
<td>
    <p><label for="Question">Questions<br> <textarea name="question" cols="30" rows="6" id="question"></textarea></label></p>
</td>
</table>            
   <div align="center">
  <input name="submit" type="submit" value="Submit" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  
  <input type="reset" name="Reset" value="Reset">
   </div>
</form>

Last edited by herkalees; Mar 5th, 2006 at 20:05.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Mar 2nd, 2006, 20:09
Junior Member
Join Date: Mar 2006
Location: Munich
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

Quote:
<form method="post" action="private.php?do=newpm&u=3275">
This is what I meant... I need the code of the page "private.php"... plz use the [php] and [/ php] tags, it's much easier that way
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Mar 2nd, 2006, 20:21
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 382
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

OK, you need to make one change to your html page,
Get rid of this
HTML: Select all
<form method="post" action="mailto:you@yourdomain.com">
<INPUT TYPE="hidden" NAME="recipient" VALUE="claire@heavenybaskets.co.uk">
<INPUT TYPE="hidden" NAME="subject" VALUE="Heavenly Baskets Order Form">
and replace it with this
HTML: Select all
<form action="feedback.php" method="post">
when you have done that you need to upload a php file onto your server.

Copy and paste the code below, I have changed the script so it uses the fieldnames you use already, however the things i have put in capitals you need to change.
Save this as feedback.php and simply upload it to your server as you would your new html file.
PHP: Select all

<?
// ------------- CONFIGURABLE SECTION ------------------------
 
$mailto 'CHANGE THIS TO YOUR EMAIL' ;
 
$subject "CHANGE THIS TO YOUR SUBJECT" ;
 
$formurl "CHANGE THIS TO WHERE YOUR FORM IS" ;

$errorurl "CHANGE THIS TO SEND YOUR VISITOR TO A PAGE WHEN THERE IS AN ERROR" ;

$thankyouurl "CHANGE THIS TO SEND YOUR VISITOR TO A PAGE WHEN IT IS SUCCESSFUL" ;
// -------------------- END OF CONFIGURABLE SECTION ---------------
$firstname $_POST['firstname'] ;
$lastname $_POST['lastname'] ;
$email $_POST['email'] ;
$question  $_POST['question'] ;
$http_referrer getenv"HTTP_REFERER" );
if (!isset(
$_POST['email'])) {
 
header"Location: $formurl" );
 exit ;
}
if (empty(
$firstname) || empty($lastname) || empty($email) || empty($question) ) {
   
header"Location: $errorurl" );
   exit ;
}
$firstname strtok$firstname"\r\n" );
$lastname strtok$lastname"\r\n" );
$email strtok$email"\r\n" );
if (
get_magic_quotes_gpc()) {
 
$comments stripslashes$question );
}
$messageproper =
 
"This message was sent from:\n" .
 
"$http_referrer\n" "\nFirst Name: " $firstname "\n" "\nLast Name: " $lastname "\nEmail: " $email 
 
"------------------------- Question --------------------------\n\n" .
 
$question .
 
"\n\n------------------------------------------------------------\n" ;
mail($mailto$subject$messageproper"From: \"$name\" <$email>\r\nReply-To: \"$name\" <$email>\r\nX-Mailer: chfeedback.php 2.04" );
header"Location: $thankyouurl" );
exit ;
?>
This should work, let us know the URL of the site so we can see it!

Craig
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Mar 2nd, 2006, 20:39
Junior Member
Join Date: Mar 2006
Location: Munich
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

Okay, I was just being lazy, that will work, great!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Mar 2nd, 2006, 20:44
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 382
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

Can we see the site?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Mar 2nd, 2006, 21:11
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

so when i make these changes, a file will be emailed to me with the feedback details in it yeah?

but the thing is at the ,
form method"post" action:
part is that there is just an email adres in there, dont know why this page displayed, private.php etc

Last edited by skyfire400; Mar 2nd, 2006 at 21:19.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Mar 2nd, 2006, 21:28
Junior Member
Join Date: Mar 2006
Location: Munich
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

I don't understand that, then why was it in the code? Do you use Dreamweaver or some other editor like DW? Where was it displayed? In the code section?

Anyway, that's not so important, the script provided by craig should work, so why work with the old one?
Can we see the site when it's ready, please?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Mar 2nd, 2006, 21:32
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

in the part craig said the change, the part in capitals, which url for where the form is? and do i put that stuff he said to add in to a sperate file called feedback.php? thats waht im thinkin anyway,
the site is still in deep works, but if you go to

www.heavenlybaskets.co.uk/contact.htm just go to view source, and see if that is of any help to u

Last edited by skyfire400; Mar 2nd, 2006 at 21:35.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Mar 2nd, 2006, 22:00
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

this is the full code for the page:

Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Heavenly Baskets</title>
<META NAME="keywords" CONTENT="baskets, heavenly, gift, gifts, heavenly baskets, aberdeen">
<META NAME="DESCRIPTION" CONTENT="a gift from heaven">

<link rel="stylesheet" href="style.css">
<style type="text/css">
<!--
.style10 {font-size: large; font-family: CygnetRound;}
.style11 {font-size: large; font-family: Arial, Helvetica, sans-serif; }
.style13 {font-size: medium; font-family: Arial, Helvetica, sans-serif; }
-->
</style>
</head>

<body background="background.jpg" STYLE="background-repeat: no-repeat; background-attachment: scroll">

<div align="center">
<div align="center">
  <p><img src="logo/logo.gif" width="236" height="212">
      
    <br>
    <br>
    <br>
    <br>
      <a class="head" href="index.htm">Home</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="about.htm">About Us</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="baskets.htm">Baskets</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="contact.htm">Get in Touch..</a><img src="spacer.gif" height="8" width="25"> <a class="head" href="order.htm">Ordering Online?</a>  <br>
     
      <br>
      <br>
      <span class="style10"><br>
  If you would like to get in touch with any questions,</span></p>
  <p class="style10"> please simply fill out the form below, and we will get back to you as soon as possible, </p>
  <p class="style10">or contact us using any of our other contact details,</p>
  <p class="style13">Office: (01224) 480923</p>
  <p class="style13">Mobile: 07706808076</p>
  <p class="style13">Email: claire@heavenlybaskets.co.uk</p>
</div>
<form method="post" action="mailto:claire@heavenlybaskets.co.uk">
<INPUT TYPE="hidden" NAME="recipient" VALUE="claire@heavenybaskets.co.uk">
<INPUT TYPE="hidden" NAME="subject" VALUE="Heavenly Baskets Order Form">

<div id="script">
  
<div align="center">
  <legend>Personal Information</legend>
</div>
<table align="center">
<td>
   <p align="center"><label for="first name">First Name: <input type="text" name="firstname" id="firstname" /></label></p>
   <p align="center"><label for="last name">Last Name: <input type="text" name="lastname" id="lastname" /></label></p>
   <p align="center"><label for="email">Your E-mail: <input type="text" name="email" id="email" /></label></p>
</td>
<td>
    <p><label for="Question">Questions<br> <textarea name="question" cols="30" rows="6" id="question"></textarea></label></p>
</td>
</table>            
   <div align="center">
  <input name="submit" type="submit" value="Submit" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  
  <input type="reset" name="Reset" value="Reset">
   </div>
</form>
</body>
</html>

Last edited by herkalees; Mar 5th, 2006 at 20:05.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Mar 2nd, 2006, 22:00
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

where it says:
<form method="post" action="private.php?do=newpm&u=3275">
there is an email address where its says "private.php
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Mar 5th, 2006, 19:32
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 382
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

I dont understand why you have not used the code I gave you. It works fine, and means your email isnt in viewable code which means you wont get loads of spam. The mailto function in a html page is a bad choice for security reasons.

The URL your form is at is : http://www.heavenlybaskets.co.uk/contact.htm
so this should replace the words in CAPS.
The form does work.

CRaig
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old Mar 5th, 2006, 20:05
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

I edited your posts. Please use code tags, they are like this, minus the spaces:

[ CODE ] all your content [/ CODE ]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old Mar 8th, 2006, 01:39
Junior Member
Join Date: Jan 2006
Age: 23
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

the form didnt work craig, dont know why, but the webstie isnt writtn with PHP, sorry for the problems.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17  
Old Mar 8th, 2006, 02:28
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 382
Thanks: 0
Thanked 0 Times in 0 Posts
Re: form help

you can easily change this in a htaccess file.

Code: Select all
 Options +FollowSymlinks
 RewriteEngine on
 RewriteRule ^(.*)\.htm$ $1.php [nc]
If you have a htaccess file already just copy and paste the code onto a new line and upload the new file.
If you havn't a htaccess file, create a file in Notepad called htaccess.txt and copy and paste the code. Upload it and then in your FTP change the filename from "htaccess.txt" to just "htaccess" without the .txt
Then your htm pages will parse like PHP pages and the form script will work!!

Craig
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote