Just when I thought I was out of the woods on this application, I decided to block someone that simply clicks the Submit button without entering any data.

I looked up the use for "if (empty($field) == TRUE" and i was pretty certain I had it right,. I still had a few punctuation errors in there, so i corrected them and ran again. Now I'm stumped. The IF statement i what's failing. Here is the before and after code too:

$WebURL = $_POST['WebURL'];

if (empty($CoName) == TRUE || empty($Address1) == TRUE || empty($City) == TRUE || empty($State) == TRUE || empty($Phone) == TRUE || empty($Email) == TRUE ||empty($SpanCat) == TRUE || empty($EngCat) == TRUE || empty($AdSize) == TRUE || empty($BusDesc) == TRUE | empty($WelcomeMsg) == TRUE || empty($WebURL) == TRUE) 
(echo "<br>You left out some required dields. <STRONG>Record NOT added</STRONG>. Enter this record again, please";
<P align="center"><A HREF="http://www.kotw.net"><STRONG>Go Back</STRONG></A></P>							
)

// connect to the database
$dbc = mysql_connect('localhost','kotw_wdps1','D0Qy6DUuOnhZ5m9R') or die('Not connected : ' . mysql_error());

Can anyone tell me what's wrong here?

1 removed () around echo
2 merged two lines,
3 changed " to '

echo "<br>You left out some required dields. <STRONG>Record NOT added</STRONG>. Enter this record again, please <P align='center'><A HREF='http://www.kotw.net'><STRONG>Go Back</STRONG></A></P> ";

Check Out the condition instead of || you have put |

empty($BusDesc) == TRUE | empty($WelcomeMsg) == TRUE

The error is because of you mixed html and php and that too you have not handled it properly...
The error is in this line.-

if (empty($CoName) == TRUE || empty($Address1) == TRUE || empty($City) == TRUE || empty($State) == TRUE || empty($Phone) == TRUE || empty($Email) == TRUE ||empty($SpanCat) == TRUE || empty($EngCat) == TRUE || empty($AdSize) == TRUE || empty($BusDesc) == TRUE | empty($WelcomeMsg) == TRUE || empty($WebURL) == TRUE) 
(echo "<br>You left out some required dields. <STRONG>Record NOT added</STRONG>. Enter this record again, please";
<P align="center"><A HREF="http://www.kotw.net"><STRONG>Go Back</STRONG></A></P>							
)

Replace this with:-

if (empty($CoName) == TRUE || empty($Address1) == TRUE || empty($City) == TRUE || empty($State) == TRUE || empty($Phone) == TRUE || empty($Email) == TRUE ||empty($SpanCat) == TRUE || empty($EngCat) == TRUE || empty($AdSize) == TRUE || empty($BusDesc) == TRUE | empty($WelcomeMsg) == TRUE || empty($WebURL) == TRUE) 
(echo "<br>You left out some required dields. <STRONG>Record NOT added</STRONG>. Enter this record again, please";

echo "<P align='center'><A HREF='http://www.kotw.net'><STRONG>Go Back</STRONG></A></P>";							
)

You must either close php tag before html code or either keep the tag inside echo
Hope it's clear

Another newbie error. I'm going to have to make echo my friend. Thank you very much for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.