Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-21-2007, 03:37 PM   PM User | #1
che_anj
Regular Coder

 
che_anj's Avatar
 
Join Date: Aug 2006
Location: Philippines
Posts: 157
Thanks: 12
Thanked 3 Times in 3 Posts
che_anj is an unknown quantity at this point
How to pass the value of the input box to other page when click the button

Hello anybody could give me idea how to pass the value of input box to other page when clicking the button..

I have a Page that will search according to what category you choose, and the query code execute to other page...

below is my code...

PHP Code:
    $searchcategory=array("Client","Jobs","Candidates");
    
$searchval=array("employer_id","vacancy_id","candidate_id");
<
form name="quicksearch" method="post">
<
tr><td>Keywords</td>
<
td><input type="text" name="qsearch" class="inputbox"></td>
</
tr>
<
tr>
                <
td >Category</td>
                <
td>
                    <
select name="find" class="small">';
                        $index=0;
                        foreach($searchcategory as $sc)
                        {
                            if($searchval[$index]==$find)
                echo '
<option value="'.$searchval[$index].'" selected>'.$sc.'</option>';
                        else
                echo '
<option value="'.$searchval[$index].'">'.$sc.'</option>';
                        $index++;
                        
                        }
                echo '
</select></td>
                </
tr>    

<
tr><td>
    <
input type="submit" name="search" value="Search">
       </
td>
</
tr>
</
form
when clicking the search button the result must display to other page

the filename of the said page is client_list.php but since all pages are under the menu.php, therefore the url looks like this http://www.mysite.com/menu.php?click...ist.php&menu=1

tnx.. hope u get it..
che_anj is offline   Reply With Quote
Old 08-21-2007, 03:44 PM   PM User | #2
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
You need to specify the next page in action="page.php" inside of the <form> tag.
Inigoesdr is offline   Reply With Quote
Old 08-21-2007, 03:57 PM   PM User | #3
che_anj
Regular Coder

 
che_anj's Avatar
 
Join Date: Aug 2006
Location: Philippines
Posts: 157
Thanks: 12
Thanked 3 Times in 3 Posts
che_anj is an unknown quantity at this point
I dont think it work because the said page was being include in the menu.php where the form for search is located...

the url must look like below..
http://www.mysite.com/menu.php?page.php&menu=1

if i will simply put the action="page.php"

it look like this
http://www.mysite.com/page.php which is not what i mean because the page.php is being called in the menu.php like this require $_GET['click'];
che_anj is offline   Reply With Quote
Old 08-21-2007, 04:19 PM   PM User | #4
rafiki
Senior Coder

 
rafiki's Avatar
 
Join Date: Aug 2006
Location: Floating around somewhere...
Posts: 2,034
Thanks: 18
Thanked 42 Times in 42 Posts
rafiki will become famous soon enough
you need to send it to menu.php then form data will be attached to menu.php like so
http://www.mysite.com/page.php?menu=...hing=something
__________________
Get Firefox Now
rafiki is offline   Reply With Quote
Old 08-21-2007, 04:29 PM   PM User | #5
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Quote:
Originally Posted by che_anj View Post
I dont think it work because the said page was being include in the menu.php where the form for search is located...

the url must look like below..
http://www.mysite.com/menu.php?page.php&menu=1

if i will simply put the action="page.php"

it look like this
http://www.mysite.com/page.php which is not what i mean because the page.php is being called in the menu.php like this require $_GET['click'];
If you want to send the variables in the URL and use $_GET to retrieve them then you need to change your form method to: method="get".
Inigoesdr is offline   Reply With Quote
Old 08-21-2007, 04:31 PM   PM User | #6
rafiki
Senior Coder

 
rafiki's Avatar
 
Join Date: Aug 2006
Location: Floating around somewhere...
Posts: 2,034
Thanks: 18
Thanked 42 Times in 42 Posts
rafiki will become famous soon enough
Quote:
Originally Posted by Inigoesdr View Post
If you want to send the variables in the URL and use $_GET to retrieve them then you need to change your form method to: method="get".
didnt catch that sorry
__________________
Get Firefox Now
rafiki is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:36 AM.


Advertisement
Log in to turn off these ads.