Php simple data storage Program
Php simple data storage Program
<Form id = "form1" name = "form1" method = "post" action = "">
<Label>
<Input type = "text" name = "cname"/>
</Label>
<P>
<Label>
<Input type = "text" name = "caddress"/>
</Label>
<Label>
<Input type = "text" name = "ctel"/>
</Label>
<Label>
<Input type = "text" name = "cfix"/>
</Label>
<Label>
<Input type = "text" name = "cmail"/>
</Label>
</P>
</Form>
<? Php
Include (dirname (_ FILE _). './inc/gg_function.php ');
If ($ _ POST)
{
$ _ Cname = Get_value ('cname', 1 );
$ _ Address = Get_value ('caddress', 1 );
$ _ Tel = Get_value ('ctel', 1 );
$ _ Fix = Get_value ('cfix', 1 );
$ _ Mail = Get_value ('cmail', 1 );
If (empty ($ _ cname) | strlen ($ _ cname)> 200)
{
ShowMsg ('enter the company name! ');
}
Elseif (empty ($ _ address) | strlen ($ _ address)> 200)
{
ShowMsg ('enter the company address! ');
}
Elseif (empty ($ _ tel) | strlen ($ _ tel)> 12)
{
ShowMsg ('Enter the correct phone number ');
}
Elseif (empty ($ _ fix) | strlen ($ _ fix)> 20)
{
ShowMsg ('enter region number ');
}
Elseif (empty ($ _ mail) | strlen ($ _ mail)> 254)
{
ShowMsg ('Enter the correct email address ');
}
Else {
$ _ SQL = "Insert into gx_coo (c_name, c_address, c_tel, c_fix, c_maile) value ('$ _ cname', '$ _ address',' $ _ tel ', '$ _ fix',' $ _ mail ')";
If (mysql_query ($ _ SQL ))
{
ShowMsg ('information saved successfully! ');
}
Else
{
ShowMsg ('Operation failed please try again! ');
}
}
}
?>