Displaying image based on condition two drop down list

Reply

Join Date: Mar 2009
Posts: 1
Reputation: nitros is an unknown quantity at this point 
Solved Threads: 0
nitros nitros is offline Offline
Newbie Poster

Displaying image based on condition two drop down list

 
0
  #1
Mar 23rd, 2009
hello all..i guess i need some help with u all experts here

i got a problem with two drop down list and a submit button.i want to make the submit button display an image following the condition of select listi want people select from drop down list 1 and drop down list 2,hit the submit button and display the image on the other page.fyi,im doing system similar with google map direction where people choose from one location to another location and when click the "get direction" button the map image will display

here's my code

  1. <?php
  2. $select1=$_POST["select1"];
  3. $select2=$_POST["select2"];
  4. if (!isset($_POST['submit']))
  5. ?>
  6.  
  7.  
  8. </label>
  9. <label></label>
  10. <form id="form3" name="form3" method="post" action="<?php echo $PHP_SELF;?>">
  11. <p>&nbsp;</p>
  12. <p>&nbsp;</p>
  13. <div id="Layer19">
  14. <select name="select1">
  15. <option value="" <?php if (!(strcmp("", $row_jj['name']))) {echo "selected=\"selected\"";} ?>>- Please Select -</option>
  16. <?php
  17. do {
  18. ?>
  19. <option value="<?php echo $row_jj['id']?>"<?php if (!(strcmp($row_jj['id'], $row_jj['name']))) {echo "selected=\"selected\"";} ?>><?php echo $row_jj['name']?></option>
  20. <?php
  21. } while ($row_jj = mysql_fetch_assoc($jj));
  22. $rows = mysql_num_rows($jj);
  23. if($rows > 0) {
  24. mysql_data_seek($jj, 0);
  25. $row_jj = mysql_fetch_assoc($jj);
  26. }
  27. ?>
  28. <?php
  29. if($_POST["select1"] == "")
  30. {
  31. mysql_select_db($database_connect_db, $connect_db);
  32.  
  33. $query_kk = "SELECT * FROM route WHERE location_1 = $select1 ";
  34. $kk = mysql_query($query_kk, $connect_db) or die(mysql_error());
  35. $row_kk = mysql_fetch_assoc($kk);
  36. $totalRows_kk = mysql_num_rows($kk);
  37.  
  38. while($row_kk = mysql_fetch_assoc($kk));
  39. $gambo = stripslashes( $row_kk['image']);
  40. }
  41. echo $kk;
  42. ?>
  43.  
  44.  
  45. </select>
  46. <p>
  47. <input type="image" name="gambo" src="<?php echo $row_kk['image']; ?>"/>;
  48. </p>
  49. </div>
  50. <p>&nbsp;</p>
  51. <p>
  52.  
  53. </p>
  54. <p>&nbsp;</p>
  55. <p>
  56. <label>
  57. <input type="submit" name="Submit" value="Submit" />
  58. </label>
  59. </p>
  60. <p>&nbsp;</p>
  61. <p>&nbsp;</p>
  62. <p>&nbsp;</p>
  63.  
  64.  
  65.  
  66. <select name="select2">
  67. <option value="" <?php if (!(strcmp("", $row_jj['name']))) {echo "selected=\"selected\"";} ?>>- Please Select -</option>
  68. <?php
  69. do {
  70. ?>
  71. <option value="<?php echo $row_jj['id']?>"<?php if (!(strcmp($row_jj['id'], $row_jj['name']))) {echo "selected=\"selected\"";} ?>><?php echo $row_jj['name']?></option>
  72. <?php
  73. } while ($row_jj = mysql_fetch_assoc($jj));
  74. $rows = mysql_num_rows($jj);
  75. if($rows > 0) {
  76. mysql_data_seek($jj, 0);
  77. $row_jj = mysql_fetch_assoc($jj);
  78. }
  79. ?>
  80.  
  81. </select>
  82.  
  83. </form>

i got 2 tables in database which is table 1 is "location" contain field "id" and "name".the 2nd table contain 5 field contain "id","loc1","loc2","image" and "text".

plz help me on doing this,im quite new to php
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC