Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder che_anj's Avatar
    Join Date
    Aug 2006
    Location
    Philippines
    Posts
    157
    Thanks
    12
    Thanked 3 Times in 3 Posts

    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..

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    You need to specify the next page in action="page.php" inside of the <form> tag.

  • #3
    Regular Coder che_anj's Avatar
    Join Date
    Aug 2006
    Location
    Philippines
    Posts
    157
    Thanks
    12
    Thanked 3 Times in 3 Posts
    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'];

  • #4
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    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

  • #5
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    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".

  • #6
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •