User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,923 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,725 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 269 | Replies: 4
Reply
Join Date: Jul 2008
Posts: 2
Reputation: Temax is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Temax Temax is offline Offline
Newbie Poster

Send more than two parameter to a page

  #1  
30 Days Ago
Is anyone who kan show me how I can send more than 2 parameters to another page? I having trouble with this. I have a search in a page.( navigation.php). Here is a dropdown. I want to send the dropdow parameter with the search word to a page called (search.php) page.

------------------------------------------------------------------------------
  1. <form action="contents.php?id=11 & par1={$mot} & par2= {$ou}" method="post">
  2. Recherche<br/>
  3. <input type="text" name="search"/><br/>
  4. <select name="fields">
  5. <option>Actualité</option>
  6. <option>Annonces</option>
  7. <option>Culture</option>
  8. <option>Ecrivains</option>
  9. <option>Musique</option>
  10. <option>Art</option>
  11. <option>Contes</option>
  12. </select>
  13. <input type="submit" name="submit" value="chercher"/>
  14.  
  15.  
  16. </form>
  17. <?php
  18. if(isset($_POST['submit']))
  19. {
  20. $mot = $_GET['name'];
  21. $ou = $_GET['fields'];





---------------------------------------------------------------------------
Thanks for anyone will help me.
Temax
Last edited by peter_budo : 29 Days Ago at 8:51 am. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 347
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 2
Solved Threads: 68
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Whiz

Re: Send more than two parameter to a page

  #2  
30 Days Ago
Each option should have an associated value. For example:
<option>Actualité</option>
should be
<option value="Actualité">Actualité</option>
Also, if you want to add variables to the url, use method="get". This will automatically place the variables into the query string.
Lost time is never found again.
- Benjamin Franklin
Reply With Quote  
Join Date: Jul 2008
Location: Hyderabad,India.
Posts: 522
Reputation: Shanti Chepuru is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 53
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Posting Pro

Re: Send more than two parameter to a page

  #3  
30 Days Ago
by this line:
<select name="fields">
</select>


you can retrieve the option value by $_POST['fields'] ..

In form tag you should use action as action="search.php".
Champions Are Not SuperNatural,They Just Fought For One More Second When Every One Else Quit...Some times That One Second Of Effort Gives You The VICTORY...
Reply With Quote  
Join Date: Jul 2008
Posts: 2
Reputation: Temax is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Temax Temax is offline Offline
Newbie Poster

Re: Send more than two parameter to a page

  #4  
29 Days Ago
Thanks Shanti
I don't use search.php because I get it throuth id=11. that means it's 3 parameters. I will try your suggestion and tell you what happened.
Temax
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 347
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 2
Solved Threads: 68
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Whiz

Re: Send more than two parameter to a page

  #5  
29 Days Ago
I don't understand what you are trying to do. Will this not work for you?
  1. <form action="contents.php?id=11" method="get">
  2. Recherche<br/>
  3. <input type="text" name="search"/><br/>
  4. <select name="fields">
  5. <option>Actualité</option>
  6. <option>Annonces</option>
  7. <option>Culture</option>
  8. <option>Ecrivains</option>
  9. <option>Musique</option>
  10. <option>Art</option>
  11. <option>Contes</option>
  12. </select>
  13. <input type="submit" name="submit" value="chercher"/>
  14.  
  15.  
  16. </form>
  17. <?php
  18. if(isset($_GET['submit']))
  19. {
  20. $mot = $_GET['search'];
  21. $ou = $_GET['fields'];
  22. echo "mot=$mot<br>";
  23. echo "ou=$ou";
  24. }
  25. ?>
Lost time is never found again.
- Benjamin Franklin
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 8:19 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC