PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old September 17th, 2002, 06:53 AM
neutcomp neutcomp is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: weesp, N-H, The Netherlands
Posts: 14 neutcomp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OnChange with sending value!

Hello I have a selection box with articals(like computer, boat, airplane) and I want if somebody select an item the next page loads with more info about the selected item. I have allready a peace of code but its not working right. Can somebody help me or know the solution!

Thanxx
Bjorn
neutcomp@hotmail.com
php Code:
Original - php Code
  1.  
  2. <HTML> 
  3. <HEAD> 
  4. <TITLE> onChange </TITLE> 
  5. <META NAME="Generator" CONTENT="EditPlus"
  6. <META NAME="Author" CONTENT=""
  7. <META NAME="Keywords" CONTENT=""
  8. <META NAME="Description" CONTENT=""
  9.  
  10. <!-- Zet dit in de head van je pagina -->   
  11. <script type="text/javascript">   
  12. function getID()   
  13. {   
  14. var ID; 
  15. ID = document.form1.getID.options[document.form1.getID.selectedIndex].value;   
  16. self.location.href = 'index.php'+ ID;   
  17. }   
  18. </script> 
  19.  
  20. </HEAD> 
  21.  
  22. <BODY> 
  23.  
  24. <!-- Het formulier in de body ;) -->   
  25. <form name="form1">   
  26. <select name="bla" onChange="getID();">   
  27. <option value="0">Auto</option>     
  28. <option value="1">Vliegtuig</option>     
  29. <option value="2">Fiets</option>   
  30. <option value="3">Computer</option>   
  31. </select>   
  32. </form>   
  33.  
  34. </BODY> 
  35. </HTML>

Reply With Quote
  #2  
Old September 17th, 2002, 06:58 AM
meldev meldev is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 meldev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: OnChange with sending value!

hi,

I think you have to write this
self.location.href = 'index.php?ID='+ ID;

and in you index.php you have to get the parameter ID and to do what you want with it

Reply With Quote
  #3  
Old September 17th, 2002, 07:08 AM
neutcomp neutcomp is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: weesp, N-H, The Netherlands
Posts: 14 neutcomp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: OnChange with sending value!

Sad but thrue Its not working!
Just try it and you will see the error message! I have changed the names just for more visibility!

php Code:
Original - php Code
  1.  
  2. <HTML> 
  3. <HEAD> 
  4. <TITLE> onChange </TITLE> 
  5. <META NAME="Generator" CONTENT="EditPlus"
  6. <META NAME="Author" CONTENT=""
  7. <META NAME="Keywords" CONTENT=""
  8. <META NAME="Description" CONTENT=""
  9.  
  10.  <!-- Zet dit in de head van je pagina -->   
  11.  <script type="text/javascript">   
  12.  function getID()   
  13.  {   
  14.   var ID; 
  15.   ID = document.form_select.ID_artikel.options[document.form_select.ID_artikel.selectedIndex].value;
  16.     self.location.href = 'index.php?ID='+ ID;
  17.  }   
  18.  </script> 
  19.  
  20. </HEAD> 
  21.  
  22. <BODY> 
  23.    
  24. <!-- Het formulier in de body ;) -->   
  25. <form name="form_select">   
  26. <select name="ID_artikel" onChange="getID();">   
  27.   <option value="0">Auto</option>     
  28.   <option value="1">Vliegtuig</option>     
  29.   <option value="2">Fiets</option>   
  30.   <option value="3">Computer</option>   
  31. </select>   
  32. </form>   
  33.  
  34. </BODY> 
  35. </HTML>

Reply With Quote
  #4  
Old September 17th, 2002, 10:39 AM
greggory greggory is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Reims, France
Posts: 82 greggory User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: OnChange with sending value!

I updated your code and must act a little better :
php Code:
Original - php Code
  1.  
  2. <HTML> 
  3. <HEAD> 
  4. <TITLE> onChange </TITLE> 
  5. <META NAME="Generator" CONTENT="EditPlus"
  6. <META NAME="Author" CONTENT=""
  7. <META NAME="Keywords" CONTENT=""
  8. <META NAME="Description" CONTENT=""
  9.  
  10. <!-- Zet dit in de head van je pagina -->   
  11. <script type="text/javascript">   
  12. function getID(f)   
  13. {   
  14. var ID; 
  15. ID = f.bla.options[f.bla.selectedIndex].value;
  16. location.replace( 'index.php?ID='+ ID );
  17. }   
  18. </script>
  19. </HEAD> 
  20.  
  21. <BODY> 
  22.  
  23. <!-- Het formulier in de body -->   
  24. <form name="form1">   
  25. <select name="bla" onChange="getID(this.form);">   
  26. <option value="0">Auto</option>     
  27. <option value="1">Vliegtuig</option>     
  28. <option value="2">Fiets</option>   
  29. <option value="3">Computer</option>   
  30. </select>   
  31. </form>   
  32.  
  33. </BODY> 
  34. </HTML>


I always pass the form when acting on a form field, using this.form syntax, which is the most compatible with the browsers (Neither 'all', nor 'layers'...)

Second thing: I use location.replace to load another page

Hope It Lps

Reply With Quote
  #5  
Old September 17th, 2002, 11:24 AM
neutcomp neutcomp is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: weesp, N-H, The Netherlands
Posts: 14 neutcomp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: OnChange with sending value!

Create it works fine know!

I was so close but also so far a way! hehe thanxx

Cya
Bjorn

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > OnChange with sending value!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway