Jump to content

Help


fife

Recommended Posts

Sorry I wouldn't know what to call this question.  Right I have this query

if(isset($_POST['insert_club'])){   
//Process data for validation  

$name    = trim($_POST['name']); 
$cat = trim($_POST['cat']);   
$memberID		=	trim($_POST['memberID']);
$validationID	=	trim($_POST['validationID']);
$creation_date   =	trim($_POST['CreationDate']);

$new_cat = trim($_POST['newCat']);

//perform validations
$errors = array();    
if(empty($name))    {        
$errors[] = "Please enter a name for your club";    
}


//Check if there were errors
if(count($errors)===0)    {        
//	Prepare data for db insertion        
$name    = mysql_real_escape_string($name);
$cat 	=	mysql_real_escape_string($cat);
$memberID		=	mysql_real_escape_string($memberID);
$validationID	=	mysql_real_escape_string($validationID);
$creation_date   =	mysql_real_escape_string($creation_date);
//post the details of the new category to me



$query = "INSERT INTO clubs                      
(`name`, `cat`, `memberID`, `validationID`, `CreationDate` )
VALUES                    
('$name', '$cat', '$memberID', '$validationID', '$creation_date' )";

$result= mysql_query($query) or die(mysql_error());
$url = "address.php?new_club=$validationID";        
header("Location: $url");     
}}

It works great.  Within that query there is a unused post  $new_cat = trim($_POST['newCat']);

 

Now I dont ever want this field entered into the database.  Firstly.  If its empty then I want nothing to happen with it but, if the user has entered something into the field then I want the contents of the field emailed to an address without effecting the rest of the query.  Is this possible?  I have written it so many different ways now and none of them seem to work.

Link to comment
https://forums.phpfreaks.com/topic/227751-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.