The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Form to Email Issues
puffywine
post Mar 28 2020, 10:36 AM
Post #1





Group: Members
Posts: 1
Joined: 28-March 20
Member No.: 27,255



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

This post has been edited by puffywine: Mar 28 2020, 10:36 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Mar 28 2020, 08:12 PM
Post #2


Programming Fanatic
********

Group: Members
Posts: 1,733
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Mar 28 2020, 10:36 PM
Post #3


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,822
Joined: 9-August 06
Member No.: 6



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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Mar 28 2020, 10:45 PM
Post #4


Programming Fanatic
********

Group: Members
Posts: 1,733
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Mar 29 2020, 06:55 AM
Post #5


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,822
Joined: 9-August 06
Member No.: 6



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Mar 29 2020, 11:41 AM
Post #6


Programming Fanatic
********

Group: Members
Posts: 1,733
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 6th June 2020 - 04:06 PM