full location name is not coming from drop down

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
raj86
Forum Commoner
Posts: 25
Joined: Tue Sep 29, 2009 12:28 am

full location name is not coming from drop down

Post by raj86 »

Hello friends
i am not getting the full location name. this location name i want to use as a key for further search.
I want to get the full location name but i am getting its part before first space.
i.e. if location is south africa , I am getting south
please help me in getting the full location name.

Code: Select all

<table>
<td>Select Location: </td>
<td>
<?php
$query="SELECT DISTINCT location FROM faculty_incharge WHERE PSRN=$psrn";

/* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */

$result = mysql_query ($query);
echo "<select name='location' value=''>Location Name</option>";
// printing the list box select command

while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "<option value=$nt[location]>$nt[location]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box 
?>
</td>
</tr>
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: full location name is not coming from drop down

Post by s.dot »

Quote the data.

Code: Select all

echo "<option value=$nt[location]>$nt[location]</option>";
to

Code: Select all

echo "<option value=\"" . $nt['location'] . "\">" . $nt['location'] . "</option>";
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
raj86
Forum Commoner
Posts: 25
Joined: Tue Sep 29, 2009 12:28 am

Re: full location name is not coming from drop down

Post by raj86 »

thanks s.dot .......its working
thanks again
Post Reply