制作PhP联系表单字段非强制性

A friend has asked me to take a look at an issue with a contact form on his simple website. He tells me that all the fields are mandatory and the form wont submit unless all are filled in, but he only wants the email address field to be mandatory.

I created most of the website but used existing code for the contact form as I'm not the most competant PhP chap, but I'm getting there.

The PhP code is as follows:

[code now removed as question answered]

Any help greatfully appreciated. I'm sure its simple, but I dont have a lot of time on my hands to correct it for him.

this line:

if (email_is_valid($youremail) && !eregi("",$youremail) && !eregi("
",$youremail) && $yourname != "" && $yourmessage != "" && substr(md5($user_answer),5,10) === $answer)

Needs to be changed, something like:

if (email_is_valid($youremail) && !eregi("",$youremail) && !eregi("
",$youremail))

Its you if statement, using [ergi()]. 1

This

if (email_is_valid($youremail) && !eregi("",$youremail) && !eregi("
",$youremail) && $yourname != "" && $yourmessage != "" && substr(md5($user_answer),5,10) === $answer) 

should be this, assuming you wish the email to be valid, have a value and the challenge is correct

if (email_is_valid($youremail) && !eregi("",$youremail) && !eregi("
",$youremail) && substr(md5($user_answer),5,10) === $answer)