| | |
Displaying image based on condition two drop down list
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2009
Posts: 1
Reputation:
Solved Threads: 0
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
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
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
PHP Syntax (Toggle Plain Text)
<?php $select1=$_POST["select1"]; $select2=$_POST["select2"]; if (!isset($_POST['submit'])) ?> </label> <label></label> <form id="form3" name="form3" method="post" action="<?php echo $PHP_SELF;?>"> <p> </p> <p> </p> <div id="Layer19"> <select name="select1"> <option value="" <?php if (!(strcmp("", $row_jj['name']))) {echo "selected=\"selected\"";} ?>>- Please Select -</option> <?php do { ?> <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> <?php } while ($row_jj = mysql_fetch_assoc($jj)); $rows = mysql_num_rows($jj); if($rows > 0) { mysql_data_seek($jj, 0); $row_jj = mysql_fetch_assoc($jj); } ?> <?php if($_POST["select1"] == "") { mysql_select_db($database_connect_db, $connect_db); $query_kk = "SELECT * FROM route WHERE location_1 = $select1 "; $kk = mysql_query($query_kk, $connect_db) or die(mysql_error()); $row_kk = mysql_fetch_assoc($kk); $totalRows_kk = mysql_num_rows($kk); while($row_kk = mysql_fetch_assoc($kk)); $gambo = stripslashes( $row_kk['image']); } echo $kk; ?> </select> <p> <input type="image" name="gambo" src="<?php echo $row_kk['image']; ?>"/>; </p> </div> <p> </p> <p> </p> <p> </p> <p> <label> <input type="submit" name="Submit" value="Submit" /> </label> </p> <p> </p> <p> </p> <p> </p> <select name="select2"> <option value="" <?php if (!(strcmp("", $row_jj['name']))) {echo "selected=\"selected\"";} ?>>- Please Select -</option> <?php do { ?> <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> <?php } while ($row_jj = mysql_fetch_assoc($jj)); $rows = mysql_num_rows($jj); if($rows > 0) { mysql_data_seek($jj, 0); $row_jj = mysql_fetch_assoc($jj); } ?> </select> </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
![]() |
Similar Threads
- Cannot find server or DNS Error - please help! (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: lightbox
- Next Thread: entering date ranges
| Thread Tools | Search this Thread |
301 apache api array autosuggest beginner binary broken cakephp checkbox class cms code compression cron curl data database date display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google href htaccess html httppost if...loop image include insert ip javascript joomla jquery key library limit link links login mail md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search searchbox server session sessions sms sorting source space sql syntax system table tutorial update upload url validator variable video volume votedown web website youtube zend





