PHP Build a Basic PHP Website (2018) Adding a Basic Form Utilizing Object Properties and Methods

Jon Benham
Jon Benham
6,444 Points

Email Form always defaulting to "Please fill in the required fields: Name, Email and Details"


I seem to be having trouble with submitting the email, whatever I do the code resorts to the first 'if' statement and outputs "Please fill in the required fields: Name, Email and Details".

I feel like I have followed the videos and code closely but clearly I am missing something somewhere!

Can anyone help?

I have attached a snapshot of my code here

3 Answers

54,332 Points

In suggest.php I added the following before your if statement:

echo $name . " " . $email . " " . $details;

and found that $details was blank

If you go to line 80 you'll find the name is details where it should be address

      <td><input type="text" name="details" id="address">

should be

      <td><input type="text" name="address" id="address">
Pascal Breitrück
Pascal Breitrück
Pro Student 3,205 Points

Hey Jon,

fix the name propertie on the input field for the address . There is details set and this will overwrite the details in a blank field.

<td><input type="text" name="address" id="address" value="">

Ps. Use the var_dump() func. to debug things ;D like the $_POST :D

Greets Pascal

Jon Benham
Jon Benham
6,444 Points

Thanks all, sorry for the delayed reply but this did work!