PHP development corporate website tutorial: Add contact us information
First we look at the html code of the following add page:
添加公司信息
Looking at the above code, the form is submitted to the addcontact.php file, which receives the parameters submitted by the form, and then adds it to the database according to the sql statement
Let’s take a look at the addcontact.php part of the code:
alert('请填写地址');history.go(-1);"; }else if(empty($tel)){ echo ""; }else if(empty($suppot)){ echo ""; }else if(empty($nexttel)){ echo ""; }else if(empty($fax)){ echo ""; }else if(empty($home)){ echo ""; }else if(empty($email)){ echo ""; }else{ $sql = "insert into `contact`(site,tel,suppot,nexttel,fax,home,email) values('$site','$tel','$suppot','$nexttel','$fax','$home','$email')"; $res = mysql_query($sql); if($res){ echo ""; }else{ echo ""; } } ?>
As shown in the above code, we have made a simple verification for the form information. It cannot be empty. When it is empty and submitted, it will Give prompt information