Forum Moderators: coopster

Message Too Old, No Replies

Help making a form

         

thegreatpretender

2:36 pm on Apr 8, 2005 (gmt 0)

10+ Year Member



Hi!

Please help me to do this.

I want to make a form that would redirect to a php page and fill with the keyword entered into a part of the script that is embedded on the page to be redirected to.

example of page to be redirected to:

<?php
require_once'/home/mzec/public_html/script/script.php';
command('blank');
?>

I would like to fill the blank with the keyword entered in the form.

Thanks a lot.

Mr_PHP

5:25 pm on Apr 8, 2005 (gmt 0)

10+ Year Member



Hi, I don't really understand what you are trying to do...

Do you just want to include a value of a variable, which was submitted with the form?
If so, use $_GET['name'] or $_POST['name'] depending on the form method (post or get), or just $name (if supported, although that might be less safe in some cases).

So that would be, for example:
command($_GET['name']);

If this is not what you mean, what do you mean?

Arno

thegreatpretender

1:39 am on Apr 9, 2005 (gmt 0)

10+ Year Member



Thanks Mr_PHP

What I mean is that when I click the form, which is an html page, it will go to a php page (with the above code)then fill the blank with the keyword entered. Is your example above do this? I'm sorry, I really don't know php. I'm just trying to do some work around in an open source script.

Thanks

4string

2:20 pm on Apr 9, 2005 (gmt 0)

10+ Year Member



Your form will send the variable (get or post) to the script you called.

If you named your form's textfield 'searchterm', your variable will be $_POST['searchterm'].

To show the result on the page use:
echo "$_POST['searchterm']";

(Depending on your form it will be GET or POST.)

thegreatpretender

1:44 am on Apr 10, 2005 (gmt 0)

10+ Year Member



Thanks Mr_Php, 4string! It works perfectly.

Mr_PHP

12:18 pm on Apr 10, 2005 (gmt 0)

10+ Year Member



Great to hear. Welcome to PHP! :)

You may find this page (and continued pages) useful:
[php.net...]