Skip to content
Advertisement

Notice: Undefined index: name in /home/kivat619/siyum.me/sup/ez/assets/php/message.php on line 2

I am trying to create a contact form with PHP.

I am getting these errors.

error

This happens when only I add this to one of the my websites It works fine on a static webpage with only the contact form.

The HTML form:

JavaScript

The PHP file:

JavaScript

I am new to PHP, I tried to find some solutions online, but failed.

I appreciate your help. Thanks

Advertisement

Answer

The browser uses the name attribute of an <input> element to pass data back to the script on the server.

JavaScript

So you need to add the name attribute

JavaScript

This will cause the browser to pass the relevent data in the $_POST['name'] variable

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement