Please enter a url name/title!
'; } //check for a description if (!empty($_POST['description'])){ $d = escape_data($_POST['description']); }else{ $d= FALSE; echo'Please enter a description!
'; } //check that the category has been selected if (isset($_POST['types']) && (is_array($_POST['types']))){ $type = TRUE; }else{ $type = FALSE; echo 'Please select a category!
'; } //if all is okay, add the url to the url table if ($u && $t && $d && $type){ $query = "INSERT INTO urls (url,title, description) VALUES ('$u', '$t', '$d')"; $result = myssql_query($query); $uid =mysql_insert_id(); } //Build the url_associations INSERT query. if ($uid > 0){ $query= 'INSERT INTO url_associations (url_id, url_category_id, approved)VALUES'; foreach ($_POST['types'] as $v){ $query .="($uid, $v, 'Y'),"; } $query= substr ($query, 0, -2); //run the second query and report the results $result = @mysql_quesry ($query); if (mysql_affected_rows()== count($_POST['types'])){ echo 'Thank You for your submission!
'; $_POST= array(); }else{ echo 'Your submission could not be processed due to a system error. We apologize for any inconvenience
'; echo ''.mysql_error(). '
Query:'. $query .'
Your submission could not be processed due to a system error. We apologize for any inconvenience.
'; echo '' .mysql_error() . 'Please try again.
'; } ?>