Jump to content

I apologise! It's a newbie to PHP feedback form problem!


RobertBruce

Recommended Posts

Hi,

 

I am a total newbie to PHP. I am also a unemployed and need to get a job. So after 100% rejection rate for job applications since last November, I have built me a little 'self-marketing' site with a prebuilt email contact form in it. The form design fits in just perfectly in terms of CSS and size. I want to retain it so I got hold of a basic online generated form.

 

I uploaded and tested the online generated basic three field name, email and comment form and feedback. php to ensure my host's systems would permit the html form to work and that I'd receive an email at my Outlook Inbox. The tests worked perfectly.

 

So I swapped over the feedback.php and html scripts to the forms I had generated based on the basic & to which I had added two extra fields - phone and company. I tested. Nothing happens. No error message. No thank you. No email. Zilch.

 

I have spent days searching for a blatant fault and retrying different formats resulting in abject failure. I need expert help.

 

I am unable to decipher the php or html (index-4.html) to find my errors, and so will be most grateful if one of you experts would please take a look at the files attached to this post. I will be pleased if you'd locate where I have screwed things up and tell me how to rectify the html form and php. I need to get the email  working because the site is where I will push potential employers to go and see me and read some of my experience and then to hopefully email me to send them my CV to get that all important interview.

 

The site is at http://rbruce.org. The domain is a subdomain. The directory is located at the true root of the main domain called p45camp.com. I had the rbruce.org folder located under public_html but the host's, Namecheap.com,  relocated it to its current location and for some reason the folder is now called rbruce.new. But it works if you point your browser to rbruce.org

 

Your help will help me start getting the responses I need. And that'll be a good thing for my bank overdraft and my family's future.

 

Thanks in advance

 

Robert Bruce

http://rbruce.org

robert@rbruce.org

 

[attachment deleted by admin]

Link to comment
Share on other sites

What problems do you seem to be having with your form..

Looking at the code I would say most of them lay within your feedback file however i did notice a small problem on index-4.

Enctype: "text/plain" should become.

enctype="text/plain"

 

Edit:

Upon further looking at your code..

<a href="/popup/thanks.html" onClick="document.getElementById('feedback').submit()">submit</a>

This is conflicting as the link wants to goto 'thanks.html' and the form wants to goto feedback.php and it cannot do both..

Your best bet is:

<a href=javascript:document.getElementById('feedback').submit()">submit</a>

and THEN redirect to the thanks.html page after the email has been successfully sent.

Link to comment
Share on other sites

What problems do you seem to be having with your form..

Looking at the code I would say most of them lay within your feedback file however i did notice a small problem on index-4.

Enctype: "text/plain" should become.

enctype="text/plain"

 

Buddski,

 

Thanks for the response. I will correct the typo. As for what is wrong, I can't tell you from a technical perspective. I suspect that on line 137 of the feedback.php the Reply-To might be at fault. I don't know. It could be many things in here that I 're-engineered' to suit my form.

 

THanks for the quick response. Appreciate it.

 

RB

Link to comment
Share on other sites

Your POST variables are not being sent across to the feedback form..

Remove the enctype="text/plain" part of the form tag and it should work as you expect..

 

<form action="feedback.php" method="post" enctype="text/plain" id="feedback">
Should be
<form action="feedback.php" method="post" id="feedback">

Link to comment
Share on other sites

Buddski

 

I corrected the html form as you suggested. FTP'sd the corrected form and tried out a test. Nothing happens. I got an error message at the left foot of the page after clicking submit.

 

What I want to happen after the user clicks submit is for a Thank You popup to appear. I have a thanks.html popup in the popup directory.

 

I created an error.html meaasage for popup too. Also in the popup directory. But not knowing the correct coding to get a popup to appear if there is an error or even the thank you if successful, these two pages revealed as full size.

 

But nothing has happened after I uploaded the corrected html in index-4

 

RB

Link to comment
Share on other sites

Can you please post line 100 from feedback.php

 

This is a step in the right direction.. it means the form is passing the data into the mailing system..

Just need to iron out the kinks..

 

As requested sir, here is line 100 from feedback:

 

if (($email_is_required && (empty($email) || !preg_match('/@/', $email))) || ($name_is_required && empty($fullname)) || ($phone_is_required && empty($phone)) || ($company_is_required && empty($company)) || ($comments_is_required && empty($comments))) {

header( "Location: $errorurl" );

exit ;

Link to comment
Share on other sites

I tested that snippet on both of my servers and it did not fail..

 

Try replacing:

 

if (($email_is_required && (empty($email) || !preg_match('/@/', $email))) || ($name_is_required && empty($fullname)) || ($phone_is_required && empty($phone)) || ($company_is_required && empty($company)) || ($comments_is_required && empty($comments))) {

 

with

 

if ((empty($email) || !preg_match('/@/', $email)) || empty($fullname) || empty($phone) || empty($company) || empty($comments)) {

 

Most of this code can be made redundant if you use a javascript form validation script but lets get it sending first..

Link to comment
Share on other sites

I tested that snippet on both of my servers and it did not fail..

 

Try h

 

if ((empty($email) || !preg_match('/@/', $email)) || empty($fullname) || empty($phone) || empty($company) || empty($comments)) {

 

Most of this code can be made redundant if you use a javascript form validation script but lets get it sending first..

 

I made the change. On clicking submit I received the thank you message (full screen) , cliced 'close' and was returned to index-4 correctly.

 

But sadly - no email has arrived at my inbox.

 

RB

Link to comment
Share on other sites

Ok..

replace

if ($use_envsender) {
mail($mailto, $subject, $messageproper, $headers, $envsender );
}
else {
mail($mailto, $subject, $messageproper, $headers );
}
header( "Location: $thankyouurl" );
exit ;

 

with

 

if ($use_envsender) {
if (mail($mailto, $subject, $messageproper, $headers, $envsender )) {
	header( "Location: $thankyouurl" ); 
} else {
	header( "Location: $errorurl" ); 
}
}
else {
if (mail($mailto, $subject, $messageproper, $headers )) {
	header( "Location: $thankyouurl" ); 
} else {
	header( "Location: $errorurl" ); 
}
}

 

This is found at the bottom of feedback.php. Let me know the result.

Link to comment
Share on other sites

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.