Jump to content

Recommended Posts

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');

 

?>

 

Link to comment
https://forums.phpfreaks.com/topic/133905-total-noob-please-help/
Share on other sites

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 />

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?

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.

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.