Page 1 of 1

full location name is not coming from drop down

Posted: Tue Jun 08, 2010 11:50 pm
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>

Re: full location name is not coming from drop down

Posted: Tue Jun 08, 2010 11:59 pm
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>";

Re: full location name is not coming from drop down

Posted: Wed Jun 09, 2010 12:01 am
by raj86
thanks s.dot .......its working
thanks again