1
neda_barna
get data from textbox
  • 2007/9/22 8:36

  • neda_barna

  • Just popping in

  • Posts: 63

  • Since: 2007/9/5 4


hi all
i have 1 textbox and 1 button in my form
now,i want search that get a word from textbox and search the word that exist in database or no
now i want know
how can get a word from database
yhis is my code but it dosent work
$word=$_POST['word'];
$query "SELECT * FROM ".$xoopsDB->prefix("tb1")." WHERE word LIKE '$word'" ;

please tell me how must write this code

2
script_fu
Re: get data from textbox

I will second that. Please do tell...

3
neda_barna
Re: get data from textbox
  • 2007/9/22 9:57

  • neda_barna

  • Just popping in

  • Posts: 63

  • Since: 2007/9/5 4


what????????????
i dont underestand what you said!!!!!

4
script_fu
Re: get data from textbox

I would like the answer to this as well.

Maybe your answer is here...

http://www.kaotik.biz/tutorial/buildmodule1.html

5
neda_barna
Re: get data from textbox
  • 2007/9/22 10:44

  • neda_barna

  • Just popping in

  • Posts: 63

  • Since: 2007/9/5 4


i read this document
but dont solve my problem
my code is:
<?php
 
include_once ( "header.php" );
 include_once ( 
XOOPS_ROOT_PATH."/class/xoopsformloader.php" );



 include 
XOOPS_ROOT_PATH.'/header.php';


    
$form '<form action="find1.php" method="post">

    <table class="eleHead"><tr>
    <td nowrap> '
._DIC_SEARCH.': <input type="text" name="key" value="" size="20" /></td>

    </tr><tr>'
;
  
//dokme ra be vasat safhe mibare
 // $form.=    '<td>&nbsp;</td></tr><tr><td colspan="2" nowrap>&nbsp;</td>';
    
$form .=    '<td nowrap> <input type="submit" class="formButton" name="search" value="'._DIC_BUTTON_GO.'" /></td>


        </tr></table>
                </form>'
;

    
$caption '<table>

            <tr class="head"><td>'
._DIC_MEAN.' </td></tr>

        </table>'
;

    
$list '<form action="find1.php" method="post">

    <table><tr><td></td>

    <td class="head"><a href="find1.php?case='
.$case.'&order=sid&order_pre='.$order.'&start='.$start.'

        &query_pre='
.$word.'&op='.$op.'">'._DIC_WORD.'</a></td>

    <td class="head"><a href="find1.php?case='
.$case.'&order=title&order_pre='.$order.'&start='.$start.'

            &query_pre='
.$meaning.'&op='.$op.'">'._DIC_MEANING.'</a></td>

    <td class="head"><a href="find1.php?case='
.$case.'&order=author&order_pre='.$order.'&start='.$start.'

            &query_pre='
.$example.'&op='.$op.'">'._DIC_EXAMPLE.'</a></td>      

    </td>

    </tr>'
;
echo 
$form;
echo 
$caption;
$word=$_POST['word'];
$query "SELECT * FROM ".$xoopsDB->prefix("tb1")." WHERE word LIKE '$word'" ;
//$query. = tb1.idE = tb3.idE";

while($myrow $xoopsDB->fetchArray($query) )

{

$word $myrow['word'];

//$meaning = $myrow['meaning'];

//$example = $myrow['example'];



$list.= '<tr><td class="even">'.$word.'</td></tr>';

}

$list.= '</table>';

echo 
$list;
$res=$xoopsDB->query($query);
//echo $res;

//$key = get_http_var( 'key' );
//$key = $this->getVar( 'key' );

//$query = "( word LIKE '%$key%'  )";

                       


include XOOPS_ROOT_PATH.'/footer.php';
?>

please read my code
do you think waht is it my problem
i think it is from this line
$word=$_POST['word'];

please tell me is it my problem

6
neda_barna
Re: get data from textbox
  • 2007/9/23 6:38

  • neda_barna

  • Just popping in

  • Posts: 63

  • Since: 2007/9/5 4


???????

7
Dave_L
Re: get data from textbox
  • 2007/9/23 9:42

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


$myts  =& MyTextSanitizer::getInstance();
$word  =  $myts->addSlashes($_POST['word']);
$table =  $xoopsDB->prefix('tb1');
$query =  "SELECT * FROM `$table` WHERE `word` LIKE '%{$word}%'";

Login

Who's Online

235 user(s) are online (136 user(s) are browsing Support Forums)


Members: 0


Guests: 235


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits