Jump to content

Recommended Posts

hello everyone, it is long time ago that i visited this forum. and as i see there is better user interface. i really enjoy it. now to my issue: ap-town.php for example select options are postcodes: NW2-Cricklewood - value="40"N1-Hixton - value="44"NW2-Kilburn - value="39"

<form action="ap-town-process.php" method="post"><select name="town"><option value="" selected="selected">Destination Town</option>	 <?php while($town_rows=mysql_fetch_array($town_result)) { ?>		 <option value="<?php echo $town_rows['lhr_town_value']; ?>"><?php echo $town_rows['lhr_town_to'];?></option>	   <?php } ?>    </select><input type="submit" /></form>


<?php $ap_town_towns=$_POST['town']; $query_towns=mysql_query("SELECT * FROM lhr_town WHERE lhr_town_value='$ap_town_towns'") or die(mysql_error());$fetch_towns=mysql_fetch_array($query_towns); ?> <form action="ap-town-execute.php" method="post"> <input type="text" name="ap_town_dropoff" value="<?php echo $fetch_towns['lhr_town_to'];?>" readonly="readonly" /> <input type="submit" /></form> 

the drop in ap-town.php takes the values from the database and would be processed at ap-town-process.php. if i select NW2-Cricklewood in the ap-town-process.php it would give me N1-Hixton altough the values are completly different. in some cases the values are the same, but the but the names area names different. please help me fix this issue.

Link to post
Share on other sites

The obvious answer is that there are several rows that have the same value for lhr_town_value. MySQL isn't going to return a result that doesn't match the conditions you specify. If it is returning a row then it matched the WHERE clause, so you have multiple records with the same values.

  • Like 1
Link to post
Share on other sites

thanks justsomeguy, your hint was helpful. to make each value unique i've just added i. e. 45.0001, 45.0002, 43.0003 instead of just 45, 45, 43. this way the return of MySQL works fine. by the way, how do i set this topic to "solved"?

Edited by sunziun
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...