Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ Form to Email Issues

Posted by: puffywine Mar 28 2020, 10:36 AM

Hello all - definite newbie here!

I am currently enrolled in a Web Design Class (online) and I cannot for the life of me figure out how to send my form data to my email. I tried HTML mailto: at first, but after researching online I am not trying PHP as everyone recommends that over mailto:.

If anyone would be so kind as to take a look at my code so far and see what I am doing wrong, I would greatly appreciate it.

this is a project from the book: Web Design with HTML & CSS3: Comprehensive by Jessica Minnick Eighth Edition

https://easyupload.io/oz7283 - my files

Posted by: CharlesEF Mar 28 2020, 08:12 PM

You have a lot more reading to do. 'mailto' ONLY works when the user has an email client installed (like Outlook or Thunderbird) on their computer. Currently, most people use some type of web mail so 'mailto' will never work for them.

You need to understand the difference between server-side and client side code and when/where it is run from. To learn/use PHP you must have a web server installed (like: IIS on Windows or Apache for *nix).

You should search the web for contact form examples, some are ready to use on your computer.

Posted by: pandy Mar 28 2020, 10:36 PM

There is a form and a script (it's all in the one php file) in the upload.

puffywine, do you run this on a server? If so, in what way doesn't it work?

Posted by: CharlesEF Mar 28 2020, 10:45 PM

I looked in contact.php and only found a 1 liner, actually it was 3 lines but the 1st and 3rd were the PHP block quotes. What file did you look at?

Posted by: pandy Mar 29 2020, 06:55 AM

I missed contact.php. The same code is also in nutrition.php together with the HTML for the page with the form (that submits to the current page).

I didn't look into the PHP, just noted it was something concerning email there. I'm not the one to advice people about PHP anyway.

Posted by: CharlesEF Mar 29 2020, 11:41 AM

The reason 'nutrition.php' doesn't work is because of this:

CODE
if($_POST["message"])
There is no element named 'message' so the if test will always fail. The form asks several questions but none of them are a 'message' element. So, the user has no place to enter a message.

Also, look into the PHP command 'include'. You could use it for the nav bar. Currently, if you need to change/add a nav link you will have to modify every page. You could make the nav bar 1 page and include it in every page. This way you only have to change the nav bar in 1 place.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)