Cannot Send Email using PHP File for Form Data

Status
Not open for further replies.

sjogrens

New Member
Messages
22
Reaction score
0
Points
1
Hello friends,
I am very new to this and have been reading quite a few threads regarding php files and sending emails with form and table data.

I have attempted this with no success.

In one post which I could not reply to because the thread was old and closed a mention of intermediate php version was said.

I went to account and could not figure out how to get this intermediate version of php. Could someone please point me in the right direction.

I received a reply from caftpx10, who was extremely helpful in pointing me to this section of the forum:

That was the OLLLDDDDD times where X10 had such options. Now it's just picking the versions.
This thread should really be either in programming or free hosting support for a better chance of support.
Have you only tested it on X10? If so then you may want to enable error logging to check if there's any errors in the PHP script in general.

Thanks,

Scott Lawrence
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi Scott,

I took a quick look at the PHP script in your account. It appears that you are sending your email to administrator[@]sjogrens.x10hosting.com. Your free hosting subdomain is an .x10host.com domain instead. Please could you try correcting this, and let me know whether you are still having issues when sending emails? :)

Thank you,
 

sjogrens

New Member
Messages
22
Reaction score
0
Points
1
Very sweet!!! Thank you Dead-i I will do this straight away my friend. Many thanks :)

Scott
 

sjogrens

New Member
Messages
22
Reaction score
0
Points
1
Dead-i I have attempted a form send via the php script and I do not see it in my admin account. How long should it take to get there? Any idea?
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi Scott,

The form in your index.html file doesn't appear to have a <form> tag pointing to your PHP script. If you are sending your email using index.html, please could you replace:
Code:
<form>
with
Code:
<form method="post" action="questionnairemail.php">

Thank you,
 

sjogrens

New Member
Messages
22
Reaction score
0
Points
1
OK excellent this worked and now I am receiving an error from line 3 on the php file.
This is where I am going to have some problems with my lack of knowledge with php language or scripting. This line 3 and line 4 point to checkboxes. I have set names and values to the checkboxes. Apparently my syntax is incorrect. Could you please help me here?

Here is the error message I receved:
Parse error: syntax error, unexpected ')' in /home/sjogrens/public_html/questionnairemail.php on line 3

I hate to be a pain and if you feel like you are spoonfeeding me please let me know and I will try to research on my own.

Many thanks mate :)
Scott
 
Last edited:

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi Scott,

On line 3, you have a closed bracket without a starting bracket.
Code:
$ProfileURL = $_POST["PRofileURL"]);

You could either remove the erroneous closed bracket, or you could prepend $_POST with strip_tags(, like you have done with the other fields. :)

Thank you,
 

sjogrens

New Member
Messages
22
Reaction score
0
Points
1
This is fantastic!!! What a stupid error on my part I missed a line when I was c/p an additional coding feature :)
This has brought us to the final syntax error I hope.

Parse error: syntax error, unexpected 'echo' (T_ECHO) in /home/sjogrens/public_html/questionnairemail.php on line 29

Last line :)

Perhaps this will take care of my dilemma

Thank you again for all of your help Dead-i
 

sjogrens

New Member
Messages
22
Reaction score
0
Points
1
I have removed line 29 and that removed that error. I would like to have some type of a feedback echo device to let the people know that the form has been submitted instead of just going to a blank page. Any ideas?
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi Scott,

What was the exact line causing this error message? :)

Thank you,
 

sjogrens

New Member
Messages
22
Reaction score
0
Points
1
It was line 29 which I have removed. It was the one that had the echo command on it. I have since removed the entire line.

I am attempting to debug some other issues though.

With the checkboxes if a box is not checked i receive an error.

I had an error with ProfileURL which I found the problem with that. The php file had an upper case R in PRofileURL which was causing an issue. That one was easy for me to find.

I would love to see some type of message once the form is submitted to say thank you, your information has been submitted and we will contact you soon. Instead of a blank page.

I still am not receiving an email. I was playing around with that email line. Not sure what is going on there.

Thanks for you help my friend. If you ever make it to Myrtle Beach, SC USA I owe you dinner :)

Scott
 

sjogrens

New Member
Messages
22
Reaction score
0
Points
1
Here are the two error message I get when I do not check boxes.

Notice
: Undefined index: SecondaryDx in /home/sjogrens/public_html/questionnairemail.php on line 9

Notice: Undefined index: UnknownDx in /home/sjogrens/public_html/questionnairemail.php on line 10

I checked the box Primary Diagnosis and did not check the other 2 boxes that was in question 6 of the questionnaire.
 

sjogrens

New Member
Messages
22
Reaction score
0
Points
1
The echo line which I removed is here sorry I forgot to answer your question regarding that:
echo "Thank you. Your request has been submitted. An administrator will be in contact with you shortly!";
 

sjogrens

New Member
Messages
22
Reaction score
0
Points
1
oh shoot the bold symbol at the beginning and the end made the text bold

"echo "Thank you. Your request has been submitted. An administrator will be in contact with you shortly!";"
 

sjogrens

New Member
Messages
22
Reaction score
0
Points
1
anyway there is a bold at the start and a slash b at the end of that line of code
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi Scott,

I still am not receiving an email. I was playing around with that email line. Not sure what is going on there.
Please could you ensure that the "From" header is the third parameter in mail(), and not the fourth? Your "thank you" message should not be in your mail() line. :)

echo "Thank you. Your request has been submitted. An administrator will be in contact with you shortly!";
That line looks fine. Please could you try re-adding it, and I'll check? ;)

With the checkboxes if a box is not checked i receive an error.
In PHP, you can use isset() to check if a checkbox has been checked, like this:
Code:
$PrimaryDx = isset($_POST["PrimaryDx"]);
$SecondaryDx = isset($_POST["SecondaryDx"]);

Thank you,
 

sjogrens

New Member
Messages
22
Reaction score
0
Points
1
OK Dead-i
I have done as you have instructed.
Isets are in place on all checkboxes. Syntaxes seem ok there.
I am getting the following error on the email line now:
Parse error: syntax error, unexpected ':' in /home/sjogrens/public_html/questionnairemail.php on line 28

This was the original email line that I had with the change from hosting to host. It had the word null in there. Don't know of null is needed.

I added the echo line at the end.

Thanks :)
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
What is in line 28? Sometimes, I end up entering a colon rather than a semi-colon at the end of a line by accident. :p
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi sjogrens,

You cannot use BB Code in PHP. I have removed the BB Code, and I have also corrected a malformed string for you. Your script now appears to be working. :)

Thank you,
 
Status
Not open for further replies.
Top