Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Contact form on 123.reg

Participant ,
Apr 14, 2017 Apr 14, 2017

Hello,

I need to add a contact for to my site and used a Lynda.com tutorial to set up the initial page.

I have downloaded the script from 123.reg -

<?php

$EmailFrom = "info@yourdomain.co.uk";

$EmailTo = "info@yourdomain.co.uk";

$Subject = "online form";

$Name = Trim(stripslashes($_POST['Name']));

$Email = Trim(stripslashes($_POST['Email']));

$Tel = Trim(stripslashes($_POST['Tel']));

$Message = Trim(stripslashes($_POST['Message']));

// validation

$validationOK=true;

if (!$validationOK) {

  echo "please check your details";

  header("Location: http://yourdommain.co.uk/contact.php");

  exit;

}

// prepare email body text

$Body = "";

$Body .= "Name: ";

$Body .= $Name;

$Body .= "\n";

$Body .= "Tel: ";

$Body .= $Tel;

$Body .= "\n";

$Body .= "Email: ";

$Body .= $Email;

$Body .= "\n";

$Body .= "Message: ";

$Body .= $Message;

$Body .= "\n";

// send email

$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page

if ($success){

  print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">";

}

else{

  print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">";

}

?>

I know I need to change the "yourdomain" parts but when I upload the php file (this script) I get a 404 message.

I have contacted 123  but was told that they cannot support code queries.

How I  get my contact for to connect to the uploaded php file.

My contact form code is -

<div id="contact">

  <form name="form1" method="post" action="http://www.ultimate-trumps.co.uk/formmail.php">

    <span id="nameTextField">

      <label for="Name"></label>

      <input type="text" name="Name" id="Name">

      <span class="textfieldRequiredMsg">A value is required.</span></span>

    <p><span id="emailTextField">

    <label for="email"></label>

    <input type="text" name="email" id="email">

    <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p>

    <p><span id="messageTextArea">

    <label for="Your message"></label>

    <textarea name="Your message" id="Your message" cols="45" rows="5"></textarea>

    <span id="countmessageTextArea"> </span><span class="textareaRequiredMsg">A value is required.</span><span class="textareaMinCharsMsg">Minimum number of characters not met.</span><span class="textareaMaxCharsMsg">Exceeded maximum number of characters.</span></span></p>

    <p>

      <input type="submit" name="submit" id="submit" value="Submit">

    </p>

  </form>

</div>

I have used a SpryAsset to create the code.

Any help is appreciated.

Thanks in advance!

6.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 14, 2017 Apr 14, 2017

This script is not where the path says it is.  And that's why you're getting a 404 error.  Check your remote server to ensure the formmail.php script is on your server at root level -- the same as your home page and contact form.

http://www.ultimate-trumps.co.uk/formmail.php

Nancy

Translate
Mentor ,
Apr 14, 2017 Apr 14, 2017

A 404 error is not a code error. It means the page can't be found. The file names must be exact as to case.

Speaking of case. Your use of case is inconsistent, which will lead to tiny problems that you may spend hours trying to resolve. My rule is to NEVER use upper case anywhere it is not necessary. People come to this forum all the time stumped because they can't figure out what's wrong with their code, and the problem turns out to be a simple lack of consistency in the use of case. You capitalize the PHP standard function "trim" but don't capitalize stripslashes. Keep that finger away from the shift key!

To resolve the 404 error, verify that both files are on the server where they should be and that the file name in the form action exactly matches the actual file name, and that when you call the html form you are using the correct file name.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 14, 2017 Apr 14, 2017

Is there anything from the above that you can see as wrong?

I have on my server

formmail.asp (123 added this)

formmail.php and

mailtest.php which 123 done to test it. They informed me that they had tested it and all worked OK. Thats as far as the help went.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 14, 2017 Apr 14, 2017

This script is not where the path says it is.  And that's why you're getting a 404 error.  Check your remote server to ensure the formmail.php script is on your server at root level -- the same as your home page and contact form.

http://www.ultimate-trumps.co.uk/formmail.php

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 14, 2017 Apr 14, 2017

Hi Nancy and Rob,

I have uploaded the site once more and tested it.

I still get the 404 error message. I have received a couple I have sent but all end up in spam box. The other thing is that all it shows is the name but the email and address are both blank.

Thanks for your help

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 14, 2017 Apr 14, 2017

Fix the code errors in your Contact Form.

Showing results for http://www.ultimate-trumps.co.uk/contact.html - Nu Html Checker

Manually upload formmail.php script.  Open the script in DW.  Hit Ctrl+Shift+U to upload it to your server.

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 14, 2017 Apr 14, 2017

https://forums.adobe.com/people/Nancy+OShea  wrote

This script is not where the path says it is.  And that's why you're getting a 404 error.  Check your remote server to ensure the formmail.php script is on your server at root level -- the same as your home page and contact form.

http://www.ultimate-trumps.co.uk/formmail.php

Nancy

formmail.php is on the server, it's just redirecting back to index.php which isn't on the server.

http://www.ultimate-trumps.co.uk/index.php

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 14, 2017 Apr 14, 2017

index.php??

Is this just a blank php page I need to create?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 14, 2017 Apr 14, 2017

nigelh70638339  wrote

index.php??

Is this just a blank php page I need to create?

You can redirect back to any page on your server. If you look in the formmail.php code you will see the below lines of code with index.php

You will probably want to create a success.html page and a failure.html page with messages "Your email has been successfully sent" and "Your email was not sent"

So this:

if ($success){

print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">";

}

else{

print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">";

}

Becomes

if ($success){

print "<meta http-equiv=\"refresh\" content=\"1;URL=success.html\">";

}

else{

print "<meta http-equiv=\"refresh\" content=\"1;URL=failure.html\">";

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 14, 2017 Apr 14, 2017

Aha! OK, I think I get it now, finally.

I will add these pages and try again.

Thanks all for the advice!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 14, 2017 Apr 14, 2017

I have finally uploaded the whole site again with the success and failure and the 404 message is no more!

The email and message are still missing and the email keeps coming up in my spam box.

Again, thanks for all the help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 14, 2017 Apr 14, 2017
LATEST

Do the form names match exactly with the formmail script variables?

In other words, same exact spelling, no spaces, case sensitive, etc...

Name

Email

Tel

Message

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Apr 14, 2017 Apr 14, 2017

As Nancy just pointed out, the files are apparently not at your web root. You need to verify the location of the files on your web server and figure out the urls to access them.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines