Page 1 of 1

[Solved] Input forms - a very simple(?) question

Posted: Tue Sep 04, 2007 1:42 am
by olavt
I have a site with dynamic MySQL data incorporated into CMSMS.

I would like to make some basic searches in the MySQL database with user input. But I have not found how to do it. What I would like to have in my user defined tag is something like this: SELECT * FROM table WHERE field=[input]%

I could be a simple "Get" prcedure, where the [input] is included as a Get variable. But it must give the result with two paramaters in the form
index.php?page=name&input=Word

In all the examples I have tried, I get only one of the parameters.

Can anyone help me with some code?

Re: Input forms - a very simple(?) question

Posted: Tue Sep 04, 2007 5:20 am
by alby
olavt wrote: I have a site with dynamic MySQL data incorporated into CMSMS.

I would like to make some basic searches in the MySQL database with user input. But I have not found how to do it. What I would like to have in my user defined tag is something like this: SELECT * FROM table WHERE field=[input]%

I could be a simple "Get" prcedure, where the [input] is included as a Get variable. But it must give the result with two paramaters in the form
index.php?page=name&input=Word

In all the examples I have tried, I get only one of the parameters.
Have you add action="get" in your search form?
Or post your search form html code

Alby

Re: Input forms - a very simple(?) question

Posted: Tue Sep 04, 2007 10:18 am
by olavt
alby wrote: Have you add action="get" in your search form?
Or post your search form html code

Alby
I have tried something like this:

echo '
Name:


';

But the result is: index.php?name=clapton , which only gives the index page, as the parameters are not correct.

Re: Input forms - a very simple(?) question

Posted: Tue Sep 04, 2007 11:23 am
by alby
olavt wrote: I have tried something like this:

echo '
Name:


';

But the result is: index.php?name=clapton , which only gives the index page, as the parameters are not correct.
No, the sintax is:
echo '
Name:


';
If artist is the alias of your page and page is value in config.php of query_var:
$config['query_var'] = 'page';

Alby

Re: Input forms - a very simple(?) question

Posted: Tue Sep 04, 2007 11:29 am
by tsw
or even

Code: Select all

<form action="index.php" method="GET">
<input type="hidden" name="page" value="mypage" />

<input type="text" name="yourvariable" value="" />
</form>
works with post also...

{Solved} Re: Input forms - a very simple(?) question

Posted: Tue Sep 04, 2007 11:55 am
by olavt
While tsw was writing his reply, I was also trying the "hidden" input, and it worked with a code like this:

echo '

Name:


';