php costum error or success message

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bkchf123
Forum Newbie
Posts: 11
Joined: Mon Jan 25, 2010 3:01 pm

php costum error or success message

Post by bkchf123 »

I would like to have the insert page, check to see if there is allready a specials name before insert into data base. If it does exsists i would like to have a <div> tag appear with that name and say error duplicatate name on the insert page. If it does not exsists go to detail page with <div> tag apear with suuccess specials name has been added.


Here is the code for the insert page

Code: Select all

 
 
<?php 
// WA Application Builder Insert
if (isset($_POST["Insert_x"])) // Trigger
{
$WA_connection = $BrowardLimo;
$WA_table = "specials";
$WA_sessionName = "WADA_Insert_specials";
$WA_redirectURL = "specials_Detail.php";
$WA_keepQueryString = false;
$WA_indexField = "id";
$WA_fieldNamesStr = "specialName|createdBy|updatedBy|email|removeOn|co mment";
$WA_fieldValuesStr = "".((isset($_POST["specialName"]))?$_POST["specialName"]:"") ."" . "|" . "".((isset($_POST["createdBy"]))?$_POST["createdBy"]:"") ."" . "|" . "".((isset($_POST["updatedBy"]))?$_POST["updatedBy"]:"") ."" . "|" . "".((isset($_POST["email"]))?$_POST["email"]:"") ."" . "|" . "".((isset($_POST["removeOn"]))?$_POST["removeOn"]:"") ."" . "|" . "".((isset($_POST["comment"]))?$_POST["comment"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,'' |',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_BrowardLimo;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?> 
 
Post Reply