I have the below code to insert text into the database. How can I check to see if the field has content and if it does enter into the db, if it doesn't to give an error message?
<?
require ( "axafdasdfaz.php" );
if ( $_POST['signup'] ) {
$sql = "INSERT INTO news(news_date, news_headline) VALUES('" . $_POST['news_date'] . "','" . $_POST['news_headline'] . "')";
$add_news_rs = $conn->Execute($sql) or die ( $conn->ErrorMsg() );
header ( "Location: thanks.php" );
}
?>
<form action="<? echo $PHP_SELF; ?>" method="post" name="add_news">
News Date: <input size="25" maxlength="70" type="text" name="news_date" value="<?php echo date("Ymd"); ?>">
<br /><br />
News Headline: <input size="25" maxlength="70" type="text" name="news_headline">
</form>