hello friends i hava a code like this and could any body help me with editing code and send me code. i am getting city values but i can't location values of city from database.thanks in advance.
<html> <head> <title>demo</title> <body> <form method="POST" action="http://localhost/vtigercrm/modules/Webforms/ post.php"> <input type="hidden" value="Leads" name="moduleName" /> <table> <tbody> <tr> <td><label>Last Name</label></td> <td><input type="text" name="lastname" value="" /></td> </tr> <tr> <td><label>First Name</label></td> <td><input type="text" name="firstname" value="" /></td> </tr> <tr> <td><label>Company</label></td> <td><input type="text" name="company" value="" /></td> </tr> <tr> <td><label>email</label></td> <td><input type="text" name="email" value="" /></td> </tr> <tr><td><label>city</label></td><td colspan=1> <select name="city"> <option>city</option> <?php $connect=mysql_connect("localhost","root","venkataz"); if(!$connect) die("access failed"); $select=mysql_select_db("vtigercrm530"); if(!$select) die("select failed"); echo "selected vtigercrm530"; $query="SELECT DISTINCT address_city FROM vtiger_users"; $result=mysql_query($query); if(!$result) die("database access failed:" . mysql_error()); while($row = mysql_fetch_array($result)) { echo "<option value>".$row['address_city']."</option>"; } ?> </select> </tr> <tr><td><label>lane</label></td><td colspan=1> <select id="lane" onselect="show();"> <option>location</option> <script type="text/javascript"> function show() { var lane=document.getElementById["lane"].selectedIndex; alert(lane); } </script> <?php $connect1=mysql_connect("localhost","root","venkataz"); if(!$connect1) die("access failed"); $select1=mysql_select_db("vtigercrm530"); if(!$select1) die("select failed"); echo ""; echo "<br/>"; $query1="SELECT address_city FROM vtiger_users"; $result1=mysql_query($query1); if(!$result1) die("database access failed:" . mysql_error()); $lcity=$_REQUEST["city"]; $rows=mysql_num_rows($result1); for($j=0;$j<$rows;$j++) if(mysql_result($result1,$j,"address_city")==$lcity) { $query2="SELECT address_street FROM vtiger_users WHERE address_city='".mysql_result($result1,$j,'address_city')."'"; $result2=mysql_query($query2); while($row= mysql_fetch_array($result2)) { echo "<option value>".$row['address_street']."</option>"; } } ?> </select> </td></tr> </tbody> <table> <input type="submit" value="Submit" /> </form> </body> </head> </html>
Ads