hello
I found this code somewhere and tried to create online dictionary with it. I managed to insert the code in to my template index.php. But after the user click submit button the result shows in other blank self created page something like index.php?act=s m. I need the results to show on the same page or somewhere with in the same template. I' ve tried every thing I can. Just I couldn't.how can I do that?
I add
but did not work out.
Thank you in advance
Best Regard's
this is the code
I found this code somewhere and tried to create online dictionary with it. I managed to insert the code in to my template index.php. But after the user click submit button the result shows in other blank self created page something like index.php?act=s m. I need the results to show on the same page or somewhere with in the same template. I' ve tried every thing I can. Just I couldn't.how can I do that?
I add
Code:
action="<?php echo $PHP_SELF; ?>
Thank you in advance
Best Regard's
this is the code
Code:
<?php
echo("<a href=admin.php>ACP</a><br>");
if(isset($_GET['act']))
{
$do=$_GET['act'];
switch($do)
{
case 'form': show_form();break;
case 'sm' : submited();break;
default : show_form; break;
}
}
else
{
show_form();
}
function show_form()
{
?>
<form name=frm method=POST action="index.php?act=sm">
Word : <input type=text name="word"> <input type=submit name="sbm" value="Submit">
</form>
<?
}
function submited()
{
require("dbconn.inc");
//if(isset($_POST['sbm']))
//{
$word=$_POST['word'];
$sql="select * from words where eng like '".$word."'";
//echo($sql);
$result=mysql_query($sql,$link);
if(@mysql_num_rows($result)!=0)
{
while($rows=mysql_fetch_array($result))
{
$vie=$rows["vie"];
}
echo("Word<b>$word</b> in vietnamese is : <b>$vie</b><br>");
?>
<form name=frm method=POST action="index.php?act=sm">
Word : <input type=text name="word"> <input type="submit" name="sbm" value="Submit">
</form>
<?
}
else
echo("Don't know that word !! My database is not update!");
//}
mysql_close($link);
}
?>
Comment