olicorse Posted November 23, 2008 Share Posted November 23, 2008 Hi, I've literally just started learning PHP this weekend... I've made a simple mail form for a website but for some reason when the fields are filled out, the email it sends swaps the "email" field with the "phone" field. I've looked over and over and i'm 100% sure that text boxes it is posting the info from are called the correct names. Could someone take a look at the code and tell me if you can see what i'm doing wrong? It's driving me crazy and it's literally the final thing I need to sort out before the site is ready! Also, I copied the first bit from another forum because I was getting backslashes whenever I typed apostrophes or speech marks. Might that have made a difference? I've tried deleting the top bit of code and re-uploading it but it still shows the Email/Phone info the wrong way round. Thanks in advance! <?php if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_POST = array_map('stripslashes_deep', $_POST); $_GET = array_map('stripslashes_deep', $_GET); $_COOKIE = array_map('stripslashes_deep', $_COOKIE); $_REQUEST = array_map('stripslashes_deep', $_REQUEST); } $name = $_POST['name']; $subject = $_POST['subject']; $telephone = $_POST['telephone']; $email = $_POST['email']; $text = $_POST['text']; $enquiry = "Name: " . $name ; $enquiry .= "\n\nPhone: " . $telephone; $enquiry .= "\n\nEnquiry: " .$text; mail('oli@hotmail.com', $subject, $enquiry, 'From:' . $name . ' <' . $email . '>'); header('Location:contactthanks.html'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/133905-total-noob-please-help/ Share on other sites More sharing options...
corbin Posted November 23, 2008 Share Posted November 23, 2008 Your form is probably messed up. Quote Link to comment https://forums.phpfreaks.com/topic/133905-total-noob-please-help/#findComment-697032 Share on other sites More sharing options...
Mchl Posted November 23, 2008 Share Posted November 23, 2008 How about your HTML code? Quote Link to comment https://forums.phpfreaks.com/topic/133905-total-noob-please-help/#findComment-697033 Share on other sites More sharing options...
dezkit Posted November 23, 2008 Share Posted November 23, 2008 Yah, post your form. Quote Link to comment https://forums.phpfreaks.com/topic/133905-total-noob-please-help/#findComment-697036 Share on other sites More sharing options...
olicorse Posted November 23, 2008 Author Share Posted November 23, 2008 Hi, thanks for all getting back so quickly - here's the form... Name: <input name="name" type="text" size="25" /> <br /> <br /> Subject: <input name="subject" type="text" size="25" /> <br /> <br /> Email: <input name="email" type="text" id="email" size="25" /> <br /> <br /> Phone: <input name="telephone" type="text" id="telephone" size="25" /> <br /> <br /> Enquiry: <textarea name="text" cols ="22" rows="3"></textarea> <br /> <br /> <input name="submit" type ="submit" value="Submit"/> <br /> Quote Link to comment https://forums.phpfreaks.com/topic/133905-total-noob-please-help/#findComment-697044 Share on other sites More sharing options...
olicorse Posted November 23, 2008 Author Share Posted November 23, 2008 Ok, this is how much of a noob I am... I just tried it again and it's working ok now! I'm new to web design in general, so does it take time for a site to change if you upload new pages? The name's of the "telephone" and "email" box were the wrong way round before, but I changed them ages ago and still had the same problem. Does it just take a while for the changes to take effect sometimes? Quote Link to comment https://forums.phpfreaks.com/topic/133905-total-noob-please-help/#findComment-697066 Share on other sites More sharing options...
premiso Posted November 23, 2008 Share Posted November 23, 2008 Ok, this is how much of a noob I am... I just tried it again and it's working ok now! I'm new to web design in general, so does it take time for a site to change if you upload new pages? The name's of the "telephone" and "email" box were the wrong way round before, but I changed them ages ago and still had the same problem. Does it just take a while for the changes to take effect sometimes? It is instant, what can happen is the browser can cache a page, hold ctrl and press F5 to refresh the page to the new copy. This is generally a problem in IE, but that ctrl+F5 refresh generally does the trick. Quote Link to comment https://forums.phpfreaks.com/topic/133905-total-noob-please-help/#findComment-697075 Share on other sites More sharing options...
Mchl Posted November 23, 2008 Share Posted November 23, 2008 Your browser will cache html pages. To make sure you're viewing current version do Ctrl+F5 to refresh cache (I also do some small visible notes that vary from version to version, so that I just see the new version's been loaded) Quote Link to comment https://forums.phpfreaks.com/topic/133905-total-noob-please-help/#findComment-697077 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.