0

the below code i am used to retrieve data from table to the list. it is working. but when i am trying to insert value from this list to another table, it inserts only the first word of each list value.

eg: for "On Process", it inserts only "On".

can anybody help me to recover from this error? i am very new to php.

<select name="client" size="1" class="maintext" id="client">
              <?php
			
			error_reporting (E_ALL ^ E_NOTICE); 
	
				
			$con = mysql_connect("localhost","root","");
			
			if (!$con)
			  {
			  die('Could not connect: ' . mysql_error());
			  }
			
			mysql_select_db("employee", $con);
			
			
				$result = mysql_query("SELECT * FROM client ORDER BY cl_value asc");
			
			
			while($row = mysql_fetch_array($result))
			  {
			  
			  echo "<option value=".$row['cl_value'].">".$row['cl_name']."</option>";
			  	  
			  }
					
			mysql_close($con);
		
	?>
                  </select>

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by mohamedsafiq
0

Check the length of the field you want to insert.
If length of this filed is 2, so it should insert "on" instead of full string as "On Process".

0

Friend provide the code you tried for insert.
and keep in mind the space in between the two words is always giving you problem so use session to store the values and insert into table.

0

sorry reply is repeated two times when i refresh so i modify it

Edited by mohamedsafiq: sorry reply is repeated two times when i refresh so i modify it

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.