How to solve this ?


#1

Hi, I am new to PHPhelp and this is my first post. I need help to how to figure it out. There is a website and in Search section when some one search a name it shows the results in this form (similar to following)
?cat_id=35
?letter=0-9
index.php?cat_id=35
index.php?letter=0-9
?letter=A

Please help me.
Thanks
Saleem


#2

Are you asking how to do it? If you are, it’s called the $_GET array. When you create forms for users to submit information, one of the parameters of the form function is the method that tells the browser how to send the information on your forms. $_GET sends the information via the URL. Like $_GET[‘fname’] to get someone’s first name would show up on the URL that you provided in the form’s action parameter.

Example:

<form action="process.php" method="get">

Would show up on the URL as http://www.mydomain.com/process.php?fname=john John being the name that was passed.

The other method is $_POST. This is used when you don’t want people to see the information on the URL usually good if you are asking for people’s passwords or you have a lot of informatin to pass seeing as there is a character limit on the URL. This ets passed in the code using the $_POST array. Hope this helps.


#3

Hi, thanks for your reply. Actually what is happening that when press the Search button, it shows the results like ?catid=35 or ?letter=9 etc, instead of actual Names of the category from the database.
I am copying few codes from a file named Showlist.php. It is a very long file but there are some codes.

if ($_GET[act]=="search")

{
$template->assign_block_vars(‘directory.list_cat’, array(
‘NAME’ => “$SiteLang[SearchResult]”,
‘URL’ => “”));
$template->assign_block_vars(‘directory.txt’, array(
‘TEXT’ => $SiteLang[‘SearchNo’]));

}

if (is_numeric($_GET[cat_id])) {

 $CatSQL = @mysql_fetch_array(@mysql_query("SELECT * FROM ".$TablePre."category WHERE id=".$_GET['cat_id']));
 if ($CatSQL['cat_sub_id']>0) {
 $CatSubSQL = @mysql_fetch_array(@mysql_query("SELECT * FROM ".$TablePre."category WHERE id=".$CatSQL['cat_sub_id']));
 $template->assign_block_vars('directory.list_cat', array(
 	'NAME' => "$CatSubSQL[cat_name]:",
 	'URL' => "href="index.php?cat_id=".$CatSubSQL[id]."""));
 }
 $template->assign_block_vars('directory.list_cat', array(
 	'NAME' => "$CatSQL[cat_name]",
 	'URL' => "href="index.php?cat_id=".$CatSQL[id]."""));
 $template->assign_block_vars('directory.txt', array(
    'TEXT' => $SiteLang['CathNo']));

[/code]