Page 1 of 1

contact form

Posted: Mon May 01, 2017 10:38 pm
by tubenirvana
I am trying to create a contact form, where a user has to enter their name, e-mail address and fill out a field with their inquiry.
All fields MUST be filled out in order to send this form.
How do I create such a form, thank you.

Re: contact form

Posted: Tue May 02, 2017 6:38 am
by Pablo

Re: contact form

Posted: Thu May 04, 2017 11:05 pm
by tubenirvana
thank you.
However, when I do a preview of the page, I get all these lines on the top of the browser.

"; } if (!empty($error)) { $errorcode = file_get_contents($error_url); $replace = "##error##"; $errorcode = str_replace($replace, $error, $errorcode); echo $errorcode; exit; } $internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha_code", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response"); $message .= $eol; $message .= "IP Address : "; $message .= $_SERVER['REMOTE_ADDR']; $message .= $eol; foreach ($_POST as $key => $value) { if (!in_array(strtolower($key), $internalfields)) { if (!is_array($value)) { $message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol; } else { $message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol; } } } $body = 'This is a multi-part message in MIME format.'.$eol.$eol; $body .= '--'.$boundary.$eol; $body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol; $body .= 'Content-Transfer-Encoding: 8bit'.$eol; $body .= $eol.stripslashes($message).$eol; if (!empty($_FILES)) { foreach ($_FILES as $key => $value) { if ($_FILES[$key]['error'] == 0 && $_FILES[$key]['size'] <= $max_filesize) { $body .= '--'.$boundary.$eol; $body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol; $body .= 'Content-Transfer-Encoding: base64'.$eol; $body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol; $body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol; } } } $body .= '--'.$boundary.'--'.$eol; if ($mailto != '') { mail($mailto, $subject, $body, $header); } header('Location: '.$success_url); exit; } ?>

Re: contact form

Posted: Thu May 04, 2017 11:51 pm
by mexman
Hi tubenirvana:
That is PHP code. If you can see THAT on a published page, you did not use the file extension .PHP but .HTML. When you see that while in PREVIEW, that is normal: A PHP code can only run in the server side, not in preview. If you don't WANT to see that code, please go to

Re: contact form

Posted: Sun Jun 18, 2017 8:38 pm
by tubenirvana
finally had a chance to change the extension to PHP, but all that coding is still showing up on the browser.
Please look here,, thanks. Even though I changed the extension to PHP in the editor, it still comes up as .HTML. I have uploaded the correct file extension and refreshed my browser, still no good.
I should also add that it does not even come up under Preview.

Re: contact form

Posted: Sun Jun 18, 2017 10:27 pm
by betwixt
My guess is you didn't remove the HTML version from the server so it is still there along with the newly published PHP version.
When seeing both names, your browser will have a preference of one over the other so it is still showing the original HTML version.

If it's there, delete contact.html so only the contact.php remains.


Re: contact form

Posted: Mon Jun 19, 2017 1:07 am
by tubenirvana
OK, thanks for that. Yes, the HTML file was still there.
So I just tried it out, and when I click on send, a new e-mail window opens up in my mail program

In the text area, this is visible -

name=Holger Schaarschmidt

in the 'To' flied, this is in ''

When I created this contact form using the form wizard, I put my e-mail address in, as well as adding a 'message' field, and apart from making each field a bit bigger, I did not add or change anything else, here is the link

This is quite frustrating.

Re: contact form

Posted: Mon Jun 19, 2017 5:44 am
by Pablo
Your page has two forms. For one of them, the form's action is set to 'mailto', so the browser will use the default email client to send the email.
Please only use one form per page and enable the built-in form processor script.

Related FAQ: ... 10&t=32967

Re: contact form

Posted: Mon Jun 19, 2017 4:05 pm
by tubenirvana
Hi Pablo,

thanks for that. I don't quite understand what you mean by that page having two forms? I actually re-did the contact page from scratch yesterday, by deleting the old form and recreating a new one, and still had the same issue.
I will check the page again and see what's happening.

Re: contact form

Posted: Mon Jun 19, 2017 5:19 pm
by Pablo
It looks like it is fixed now.

Re: contact form

Posted: Mon Jun 19, 2017 6:06 pm
by tubenirvana
yes, got it all up and running, thank you for your help.

Also, in your 'help' instructions, you mention that Go Daddy does not support PHP, they do now, as it is Go Daddy that I use.
Again, thanks for your help!