Jump to content

Contact form problem


ripopgodazippa

Recommended Posts

Hi all,

My first post here. I would be very thankful if you could help me with a recent problem of mine.

I have been asked to put together a website for my friend, as I used to dabble with a little HTML in my teens - I have been 'out of it' for 10 years and a lot has changed! so I am trying to play catch up as you can imagine.

One of my friend's requests was for a contact form with a few, in my view, complicated components - like checkboxes and alternative questions than the usual 'Name' 'Email' 'Contact number' etc.

I have copied across the code I am using, I was wondering if any of you could highlight where I am going wrong. On a test run of the form, I am receiving the error: 'Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in D:\Hosting\11889492\html\contact_nextstep\contact.php on line 16
Error!'

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
		  <form action="contact_nextstep/contact.php" method="post">
  <table border="0" cellpadding="8" cellspacing="8">
  
  <tr><td><B>What would you like to achieve with your health and fitness?</B>:<P><input type="text" name="q1" size="70" /></td></tr>
  
  <tr><td><B>Out of the following, which are your top 3 concerns?</B>:<P>
  <input type="checkbox" value="weight" name="q2">  Weight  
  <input type="checkbox" value="tone" name="q2">  Tone  
  <input type="checkbox" value="shape" name="q2">  Shape  
 <input type="checkbox" value="mobility" name="q2">  Mobility  
 <input type="checkbox" value="energy" name="q2">  Energy   <BR>
 <input type="checkbox" value="water" name="q2">  Water retention  
 <input type="checkbox" value="fitness" name="q2">  Fitness  
 <input type="checkbox" value="appearance" name="q2">  Improve appearance  </td></tr>
 
 <tr><td><B>When you look in the mirror, physically how do you view yourself?</B>:<P><input type="text" name="q3" size="70" /></td></tr>
 
 <tr><td><B>Does the way you view yourself, make you feel...</B>:<P>
 <input type="checkbox" value="content" name="q4">  Content  
 <input type="checkbox" value="frustrated" name="q4">  Frustrated  
 <input type="checkbox" value="sad" name="q4">  Sad  </td></tr>
 
 <tr><td><B>What potential problem(s) could get in the way of you achieving your goals?</B>:<P><input type="text" name="q5" size="70" /></td></tr>
 
 <tr><td><B>How does the way you look and feel hold you back in life?</B>:<P><input type="text" name="q6" size="70" /></td></tr>
 
 <tr><td><B>How would achieving this goal impact your life?</B>:<P><input type="text" name="q7" size="70" /></td></tr>
 
 <tr><td><B>Name</B>:<P><input type="text" name="name" size="25" /></td></tr>
 <tr><td><B>Email</B>:<P><input type="text" name="email" size="25" /></td></tr>
 <tr><td><B>Contact number</B>:<P><input type="text" name="contact" size="25" /></td></tr>
 
 <tr>
 <td align="center" colspan="2">
 <B><BR><FONT COLOR="#ff6c00">Only click the Next Step button if you are ready to begin <BR> your transformation and get the results you deserve.</FONT></B><BR><BR>
 <input type="submit" value="Next Step"><br />
 </td>
 </tr>
 </table>
 </form>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
		  <?php
  $q1 = $_POST['q1'];
  $q2 = $_POST['q2'];
  $q3 = $_POST['q3'];
  $q4 = $_POST['q4'];
  $q5 = $_POST['q5'];
  $q6 = $_POST['q6'];
  $q7 = $_POST['q7'];
  $name = $_POST['name'];
 $email = $_POST['email'];
 $contact = $_POST['contact'];
 $formcontent=" From: $name \n Contact number: $contact \n What would you like to achieve with your health and fitness: $q1 \n Out of the following which are your top 3 concerns: $q2 \n When you look in the mirror physically how do you view yourself: $q3 \n Does the way you view yourself make you feel: $q4 \n What potential problems could get in the way of you achieving your goals: $q5 \n How does the way you look and feel hold you back in life: $q6 \n How would achieving this goal impact your life: $q7";
 $recipient = "muscolino@gmail.com";
 $subject = "JP Budget Fitness website submission";
 $mailheader = "From: $email \r\n";
 mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
 echo "Thank you!";
 ?>

Also, I feel really cheeky asking for some reason but do any of you know how to redirect the user to my own thankyou.html and error.html pages? As again, that is another request from my friend that without your help, I doubt I would be able to achieve. Google has not been kind this time round!

Thank you in advance for your help. (if anyone helps that is...)

Pete

 

(A live version is available at http://www.jpbudgetfitness.com/nextstep.html)

Link to comment
Share on other sites

I did a bit of research on your SMTP error and found the question here: http://stackoverflow.com/questions/2075588/smtp-server-response-451

 

The OP answered it himself:

 

EDIT: I looked into it a bit more, and it turns out the GoDaddy windows hosting(NOT my choice) doesn't allow the PHP mail function. So I either find a workaround that works(looks like there's a few out there, not many that seem to work), or I get them to switch to Linux hosting(which might fix it).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.