Search the Community
Showing results for tags 'blank field'.
-
hi i really need your help what im trying to do is check if form fields are empty and then if so stop users from going any further i got the jist sorted e.g. send data to a database and this is the main code <?php $con=mysqli_connect("","","",""); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql="INSERT INTO tbl_club_contacts (CompanyName) VALUES ('$_POST[CompanyName]')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "record added"; mysqli_close($con); ?> <html> <body> <form action="copyofaddleads2.php" method="post"> <input type="submit", value = "go back"> </form> </body> </html> heres the insert document <?php $con=mysqli_connect("","","",""); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql="INSERT INTO tbl_club_contacts (CompanyName, FirstName, Address1, Address2, Area, City) VALUES ('$_POST[companyname]','$_POST[firstname]','$_POST[address1]','$_POST[address2]','$_POST[area]','$_POST[city]')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "record added"; mysqli_close($con); ?> <html> <body> <form action="addleads2.php" method="post"> <input type="submit", value = "go back"> </form> </body> </html>
- 5 replies
-
- help
- blank field
-
(and 1 more)
Tagged with: