Jump to content

need help in my edit form page


pixeltrace

Recommended Posts

hi,

 

i have a edit form for my brand items

and one of the items that i may need some validation is

the brand name.

 

my problem is, i need a validation code for the brand name

wherein if the brandname was changed it will execute this validation

to check if there is already an existing brand name

but if the brandname was not changed it will not execute this validation code.

 

currently this the validation code that i am using

 $sql_brand_name_check = mysql_query("SELECT brand_name FROM engsoon_brands WHERE brand_name!='$brand_name' AND bid!='$bid'");
  $brand_name_check = mysql_num_rows($sql_brand_name_check);
	if($brand_name_check > 0){
		echo '<script language=javascript> alert("brand name already exist.<br>use a different brand name!");top.location = "brandsmngr.php?id=3&bid='.$bid.'";</script>';
		unset($brand_name);
		exit();

 

this one no matter i modify the brand name or not, its still prompting me the message.

hope you could help me fix this.

 

thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.