Jump to content

[SOLVED] Data to Text Field


manels1111

Recommended Posts

Hi everyone I'm fairly new to mysql and somewhat ok with php.  Anyhow using 5.0.18 mysql. Here is problem which might be fairly simple but I can't figure it out.  I'm pulling data from a table in mysql that for each row I create a text field and set the value to the value from the database. This is working except its only displaying the first word of the stored data.  So "Half Court" is stored in the database and when my text field is filled with the value it only fills with "Half"

 

Here is the layout.

 

IDcat_idcategory

11Half Court

12Full Court

13Jump Stop

 

Here is the php to pull the code

<?
  $ID=$_REQUEST['ID'];
  ?>
  <form name="testform" method='POST' action='inputdrills.php'>

  <?
  require "config.php";// connection to database 
  $result = mysql_query("SELECT * FROM category WHERE ID = '$ID'")or die(mysql_error());
	while($row = mysql_fetch_array( $result )) {

			echo "<input type='text' name=$row[cat_id] value=$row[category]>";

	}

	?>
  
<br>	
<input type="Submit" value="Save Drills">

	</form>

 

 

Everything works fine but I get three text fields created and everything but only the first word of the stored database information shows up in the text field.  Am I missing something really simple?

 

Thanks in advance

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.