callmecheez Posted May 28, 2008 Share Posted May 28, 2008 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( "[email protected]", "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 https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/ Share on other sites More sharing options...
jonsjava Posted May 28, 2008 Share Posted May 28, 2008 <?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( "[email protected]", "New helpdesk email", $message, "From: $name <$email>" ); header( "Location: http://www.leeds.ac.uk/iss/contact_test/thankyou.html" ); ?> Link to comment https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-551717 Share on other sites More sharing options...
callmecheez Posted May 28, 2008 Author Share Posted May 28, 2008 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 https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-551733 Share on other sites More sharing options...
callmecheez Posted May 28, 2008 Author Share Posted May 28, 2008 Also - can you advise me how best I can 'format' my form. I'd like to align all the fields so they look tidy etc. . Many thanks Link to comment https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-552169 Share on other sites More sharing options...
.josh Posted May 29, 2008 Share Posted May 29, 2008 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 https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-552245 Share on other sites More sharing options...
callmecheez Posted May 29, 2008 Author Share Posted May 29, 2008 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 https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-552366 Share on other sites More sharing options...
.josh Posted May 29, 2008 Share Posted May 29, 2008 I split your last post into a new thread and moved it to html help forum. If you have more than one question, make a new thread for it, especially when it's an unrelated question. Link to comment https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-552434 Share on other sites More sharing options...
.josh Posted May 29, 2008 Share Posted May 29, 2008 As far as it printing twice: can you repost your current php code since I'm sure you've fiddled with it by now? Link to comment https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-552438 Share on other sites More sharing options...
callmecheez Posted May 29, 2008 Author Share Posted May 29, 2008 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( "[email protected]", "New helpdesk email", $message, "From: $name <$email>" ); header( "Location: http://www.leeds.ac.uk/iss/contact_test/thankyou.html" ); ?> Link to comment https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-552439 Share on other sites More sharing options...
.josh Posted May 29, 2008 Share Posted May 29, 2008 sorry can you please post the code with the form in it too? Link to comment https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-552442 Share on other sites More sharing options...
callmecheez Posted June 3, 2008 Author Share Posted June 3, 2008 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( "[email protected]", "New helpdesk email", $message, "From: $name <$email>" ); header( "Location: http://www.leeds.ac.uk/iss/contact_test/thankyou.html" ); ?> Link to comment https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-556340 Share on other sites More sharing options...
callmecheez Posted June 3, 2008 Author Share Posted June 3, 2008 bump! anyone? Link to comment https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-556727 Share on other sites More sharing options...
jonsjava Posted June 3, 2008 Share Posted June 3, 2008 <?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( "[email protected]", "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 https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-556766 Share on other sites More sharing options...
callmecheez Posted June 3, 2008 Author Share Posted June 3, 2008 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 https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-556786 Share on other sites More sharing options...
callmecheez Posted June 4, 2008 Author Share Posted June 4, 2008 bump please Link to comment https://forums.phpfreaks.com/topic/107636-help-with-feedback-form/#findComment-557342 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.