Page 1 of 1

check input from textbox

Posted: Thu Jan 15, 2009 12:16 pm
by kabucek
hi all,
i have this piece of code to check the textbox input:

Code: Select all

$selectedProdCode="LMQ";
if ($memberDataArray['eventDate']="FEBRUARY 28")   //changed from ttevents
 {
    $selectedProdCode="febevent";
         }
 
 elseif ($memberDataArray['eventDate']='ttevents')
 {
    $selectedProdCode="ttevents";
         }
- with this i want to check:
if user types: FEBRUARY 28 in the box the system will select febevent

if user tyeps: ttevents in the box the system will select ttevents


somehow it doesn't work, it selects febevent all the time.

thanks!

Re: check input from textbox

Posted: Thu Jan 15, 2009 4:33 pm
by orobian
Hi kabucek,
the problem you face is beacuse of the =. You should have two of them to check if a var equals another, so:

Code: Select all

 
   1. $selectedProdCode="LMQ";
   2. if ($memberDataArray['eventDate']=="FEBRUARY 28")   //changed from ttevents
   3.  {
   4.     $selectedProdCode="febevent";
   5.          }
   6.  
   7.  elseif ($memberDataArray['eventDate']=='ttevents')
   8.  {
   9.     $selectedProdCode="ttevents";
  10.          }
 

Re: check input from textbox

Posted: Thu Jan 15, 2009 4:41 pm
by kabucek
yes, I've tried that and it didn't work.

this: $memberDataArray['eventDate']
is the value of the textbox,
does "if" function work with textboxes?
maybe there is a way to use switch or some function?
I'm thinking about something maybe like:

Code: Select all

$selectedProdCode = <what to put here ???> ('febevent');
SWITCH ($selectedProdCode):
   CASE $memberDataArray['eventDate']('febevent');
      $selectedProdCode="febevent" . $selectedProdCode;
      BREAK;
   CASE $memberDataArray['eventDate']('ttevents');
      $selectedProdCode="ttevents" . $selectedProdCode;
      BREAK;
ENDSWITCH;

Code: Select all

any other ideas?

thanks