Log in

View Full Version : php file will not send form



theremotedr
02-12-2017, 02:28 PM
Hi,

I have a form which can be seen here http://www.theremotedoctor.co.uk/form-contact-new.html

The form you see on the page has a couple extra fields added from its default state BUT the php file is untouched.
So when i receive the form in my email the extra fields are not shown.

I have "what i thought was correct" added the extra text to another php file but the form will not send.
I have attached below,
The original php file which works "but has the extra missing fields"
My edited php file.

Please could you take a look and advise where i made an error which stops the form being sent.
It must be something simple but i cant spot it.

Thanks very much.

styxlawyer
02-12-2017, 05:35 PM
In your file at line 41 you are looking for "email_address":



!isset($_POST['email_address']) ||



but at line 65 you are trying to scan for "email":



$email_from = $_POST['email']; // required


The entity "email" doesn't exist in the data received from the form so the PHP code will fail.

mlegg
02-12-2017, 06:36 PM
I think this was your problem with the form I gave you too.

theremotedr
02-12-2017, 06:47 PM
Please could you assist with th php with the pages form.

theremotedr
02-12-2017, 08:51 PM
In your file at line 41 you are looking for "email_address":



!isset($_POST['email_address']) ||



but at line 65 you are trying to scan for "email":



$email_from = $_POST['email']; // required


The entity "email" doesn't exist in the data received from the form so the PHP code will fail.

Well ive read it but like again makes no sense to me.
Are you able to look at my form http://www.theremotedoctor.co.uk/form-contact-new.html
And make the required edits so the form will send please.

I can then just upload the file & finished for all days works doing this.

mlegg
02-12-2017, 10:45 PM
did you upload the php files folder?

theremotedr
02-12-2017, 11:36 PM
Yes
It's in the root with all the HTML files.
It's called send_form_email.php

styxlawyer
02-12-2017, 11:45 PM
The problem isn't in the HTML file. As I said before the problem is in line 65 of your modified "send_form_email.php" file.

On line 185 of the HTML file you have this:



<td valign="top"><label for="email_address">Email Address *</label></td>


which defines the field identifier as "email_address". But in the PHP file on line 65 you have:



$email_from = $_POST['email']; // required


which is looking for a field labelled as "email". That field doesn't exist so the PHP will fail. You need to change line 65 in the "send_form_email.php" file to the following:



$email_from = $_POST['email_address']; // required


That is the first problem I noticed so you need to change that and try it. If it still doesn't work we'll need to look further.

mlegg
02-12-2017, 11:56 PM
theremotedoctor, this page uses the Bootstrap version that I showed you in the other question post. http://ahepa215.org/contact.html

theremotedr
02-13-2017, 12:21 AM
I committed to now getting this php working after what I've done today.
I can't afford to start over again.

Are to able to edit the php I supplied above for the current form in use.
Otherwise it's a needle in the haystack again tomorrow.

I know it's not the HTML & didn't say it was hence supplying the two php files.

theremotedr
02-13-2017, 02:15 PM
Hi,
php file line 65 is

$email_from = $_POST['email_address']; // required

html file line 185 is

<label for="email_address">Email Address *</label>

Stilll no joy.

styxlawyer
02-13-2017, 06:00 PM
Upload this php file to your server and you should receive an email.

6111

You do not need to make any changes to the existing HTML file as I have edited the PHP file to match your form definitions.

Please note that, on many servers, PHP mailer may not work if the destination and source email addresses are the same. This is a spam prevention measure.

theremotedr
02-13-2017, 06:09 PM
Thanks for your input.
I have now concentrated on a form which is nearly working.