0

I have a combo box "verb" that displays a field of database .. when the user selects "other" from the drop down ...a div named "choicetext" appears and user enters his choice of verb ....

The below code is of the action page ..in which i want to insert the "choicetext" value in that field of database... but should enter nothing if the user slects from the existing dropdown of "verb"

I succceded to enter the new one .. but whenever the user selects frm existing dropdown .. a blank entry happens in DB ...Plz help me ..thanx in advance

<?php
 $verb=$_REQUEST['verb'];
 $item=$_REQUEST['item'];
 $choice_verb=$_REQUEST['choicetext'];
 $verb_category="SRS";
 $added_by="";
 $added_on=date("Y/m/d");;
 $status=1;
 
if('$choicetext'!="" && '$verb'=="other") {

// Insert data into tb_verb_master 
$sql="INSERT INTO  tbl_verbs_master(verb_category,verb_description,added_by,added_on,status)VALUES('$verb_category', '$choice_verb','$added_by','$added_on','$status')";
$result2=mysql_query($sql) or die(mysql_error());

  }
  else {
          ?????
  }
3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by Shanti C
0

try this

//if('$choicetext'!="" && '$verb'=="other"){
if($choicetext !="" && $verb=="other"){ //see the difference? variables are without the single quote
0

try this

//if('$choicetext'!="" && '$verb'=="other"){
if($choicetext !="" && $verb=="other"){ //see the difference? variables are without the single quote

Thnnk you so very much ... :).. that worked ...

can u help me one more thing ...when i enter through choicebox (i.e other option) the variable "verb_category" which is already defines as "SRS" is not being entered ... y so ?even the date is like 0000-00-00 :(

Edited by pearll: n/a

0

once check your database table column data type once for these two fields : verb_category,added_on.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.