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>

Recommended Answers

All 3 Replies

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".

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.