Jump to content

help with feedback form . .


callmecheez

Recommended Posts

Hey guys, really sorry to ask as I'm sure its an irritatingly frequent query but I'm struggling with a feedback form.

 

I want a feedback form that'll have 4 or 5 fields, one to be text area; and have all info emailed to an address.

 

I've got an index.html:

   1. <form method="post" action="sendmail.php">
   2.   Name: <input name="name" type="text" /> <br />
   3.   Email Address: <input name="email" type="text" /><br />
   4.   ISS Username (if known): <input name="username" type="text" /><br />
   5.   Telephone Number: <input name="phone" type="text" /><br />
   6. Message:<br />
   7.   <textarea name="message" rows="15" cols="40">
   8.   </textarea><br />
   9.   <input type="submit" />
  10. </form>

 

and sendmail.php:

   1. <?php
   2.   $email = $_REQUEST['email'] ;
   3.   $name = $_REQUEST['name'] ;
   4.   $username = $_REQUEST['username'] ;
   5.   $phone = $_REQUEST['phone'] ;
   6.   $message = $_REQUEST['message'] ;
   7.  
   8.   mail( "callmecheez@gmail.com", "New helpdesk email",
   9.          "From: $name <$email>" ); 
  10.      "$message\nCustomer Username:$username\n".
  11.      "$message\nCustomer Contact Number:$phone\n".
  12.      "$message\nDescription: $message\n".
  13.  
  14.   header( "Location: http://www.leeds.ac.uk/iss/contact_test/thankyou.html" );
  15. ?>

 

Been stuck with this all day, and just not knowledgeable enough to figure it out. Any help gratefully received.

Link to comment
Share on other sites

<?php
   $email = $_REQUEST['email'] ;
   $name = $_REQUEST['name'] ;
   $username = $_REQUEST['username'] ;
   $phone = $_REQUEST['phone'] ;
   $message = $_REQUEST['message'] ;
   $message .= "\nCustomer Username:$username\n";
   $message .= "\nCustomer Contact Number:$phone\n";
   $message .= "\nDescription: $message\n";
   mail( "callmecheez@gmail.com", "New helpdesk email", $message, "From: $name <$email>" ); 
   header( "Location: http://www.leeds.ac.uk/iss/contact_test/thankyou.html" );
?>

Link to comment
Share on other sites

Many thanks jonjava, really appreciate the reponse.

 

As a test I filled out my fields with "email filed" "username field" etc; as a test as I got the following email:

 

Body

Customer Username:Username field

 

Customer Contact Number:phone number

 

Description: Body

Customer Username:Username field

 

Customer Contact Number:phone number

 

 

I can't spot what it is that's not quite right. .

Link to comment
Share on other sites

Many thanks jonjava, really appreciate the reponse.

 

As a test I filled out my fields with "email filed" "username field" etc; as a test as I got the following email:

 

Body

Customer Username:Username field

 

Customer Contact Number:phone number

 

Description: Body

Customer Username:Username field

 

Customer Contact Number:phone number

 

 

I can't spot what it is that's not quite right. .

 

so...what exactly isn't right? It looks to me like you got an email containing exactly what you submitted in the form.  Be more specific.

Link to comment
Share on other sites

Body

Customer Username:Username field

 

Customer Contact Number:phone number

Description: Body

Customer Username:Username field

 

Customer Contact Number:phone number

 

 

Body appears at the top, the username, then phone number.

 

Then description <body> again, then username again, then phone number again. .

 

Info is repeated. .? Thanks :)

Link to comment
Share on other sites

Thanks Crayon Violet, sorry about that.

 

Current code:

<?php
   $email = $_REQUEST['email'] ;
   $name = $_REQUEST['name'] ;
   $username = $_REQUEST['username'] ;
   $phone = $_REQUEST['phone'] ;
   $location = $_REQUEST['location'] ;
   
   $message = $_REQUEST['message'] ;
   $message .= "\nUsername****:$username\n";
   $message .= "\nContact Number****:$phone\n";
   $message .= "\nEmail Address****:$email\n";
   $message .= "\nLocation Details****:$location\n";
   
   
mail( "callmecheez@gmail.com", "New helpdesk email", $message, "From: $name <$email>" ); 
   header( "Location: http://www.leeds.ac.uk/iss/contact_test/thankyou.html" );
?>

Link to comment
Share on other sites

Hi (again. . !),

 

See below for my HTML & php, I think I have it looking / working as I'd hoped now, many thanks for the help previously

 

I just wondered if anyone could help me out; I would like to make 1 field (name) mandatory. . ; can anyone help please? :)

 

Thank you

 

 

HTML:

<

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

                                             <table width="580" border="0" align="center">
                          <tr>
                            <td width="296"><div align="right">Name:</div></td>
                            <td width="268"><div align="left">
                              <input name="name" type="text" /></td
                          ></tr>
                          <tr>
                            <td><div align="right">Email Address:</div></td>
                            <td><div align="left"><input name="email" type="text" /></td>
                          </tr>
                          <tr>
                            <td><div align="right">ISS Username (if known):</div></td>
                            <td><div align="left"><input name="username" type="text" /></td>
                          </tr>
                          <tr>
                            <td><div align="right">Telephone Number:</div></td>
                            <td><div align="left"><input name="phone" type="text" /></td>
                          </tr>
                          <tr>
                            <td><div align="right">Location (e.g room number):</div></td>
                            <td><div align="left"><input name="location" type="text" /></td>
                          </tr>
                          <tr>
                            <td><div align="right">Please provide details of the problem, or leave any message here.<br>
                              <br>
                            Press 'submit' when done.</div></td>
                            <td><div align="left"><textarea name="message" rows="10" cols="40"></textarea></td>
                          </tr>
                        </table><br>
                        <input type="submit" VALUE="Submit" align="right"/><br>
					</form>

 

PHP:

 

<?php
   $email = $_REQUEST['email'] ;
   $name = $_REQUEST['name'] ;
   $username = $_REQUEST['username'] ;
   $phone = $_REQUEST['phone'] ;
   $location = $_REQUEST['location'] ;
   
   $message = $_REQUEST['message'] ;
   $message .= "\nUsername****:$username\n";
   $message .= "\nContact Number****:$phone\n";
   $message .= "\nEmail Address****:$email\n";
   $message .= "\nLocation Details****:$location\n";
   
   
mail( "sample@leeds.ac.uk", "New helpdesk email", $message, "From: $name <$email>" ); 
   header( "Location: http://www.leeds.ac.uk/iss/contact_test/thankyou.html" );
?>

Link to comment
Share on other sites

<?php
   $email = $_POST['email'] ;
   $name = $_POST['name'] ;
   $username = $_POST['username'] ;
   $phone = $_POST['phone'] ;
   $location = $_POST['location'] ;
   
   $message = $_POST['message'];
   $message .= "\nUsername****:$username\n";
   $message .= "\nContact Number****:$phone\n";
   $message .= "\nEmail Address****:$email\n";
   $message .= "\nLocation Details****:$location\n";
   
   
mail( "sample@leeds.ac.uk", "New helpdesk email", $message, "From: $name <$email>" ); 
   header( "Location: http://www.leeds.ac.uk/iss/contact_test/thankyou.html" );
?>

I just changed request to post. I don't see how that would change a thing, but everything else is correct already, so I decided to give that a go.

Link to comment
Share on other sites

Jons java; thanks for your help as always.

 

However the form is working fine now, if you look at my post above mainly

 

I would like to make 1 field (name) mandatory. . ; can anyone help please?

 

That's the bit i'm stuck with at the moment!

 

Thanks :)

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.