Jump to content

[SOLVED] PHP & input text boxes


dlusiondone

Recommended Posts

Hi guys,

 

Having a bit of trouble populating an input text box with results from a table. For some reason it's not posting the entire result, instead it's posting the first word i.e "Seven" instead of the whole result i.e "Seven Pounds". I know its something simple but can't seem to figure it out. I guess that were the experts come in.

 

Thanks in advance by the way.

 


include ("server.php");

$query = "select * from movies";

$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result)) 
{
echo ("<div id=\"imgTxt\">
	<form method=\"post\" action=\"saved_confirm\">
		<strong>MOVIE TITLE:</strong>    
		<input type=\"text\" name=\"mTitle\" size=\"40\" maxlength=\"100\" value=" .$row["movie_title"]. " /><p />
		<strong>RELEASE DATE:</strong>  
		<input type=\"text\" name=\"mRelease\" size=\"40\" maxlength=\"100\" value=" .$row["release_date"]. "/><p />
		<strong>IMAGE NAME:</strong>    
		<input type=\"text\" name=\"imgName\" size=\"40\" maxlength=\"100\" value=" .$row["images"]. " /><p />
		<strong>MOVIE RATING:<strong>
		<input type=\"text\" name=\"mRelease\" size=\"40\" maxlength=\"100\" value=" .$row["ratings"]. " /><p />
		<strong>MOVIE DESCRIPTION:</strong><br />
     	                 <textarea rows=\"10\" cols=\"40\" name=\"mDescrp\" wrap=\"physical\">" .$row["description"]."</textarea>
		<hr /></form>
		</div>");	
}

Link to comment
Share on other sites

You forgot quotes around the values of the value attributes. This should be easy to spot when you look at the source code spat out by PHP.

 

include ("server.php");

$query = "select * from movies";

$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result))
   {
   echo ("<div id=\"imgTxt\">
      <form method=\"post\" action=\"saved_confirm\">
         <strong>MOVIE TITLE:</strong>    
         <input type=\"text\" name=\"mTitle\" size=\"40\" maxlength=\"100\" value=\"" .$row["movie_title"]. "\" /><p />
         <strong>RELEASE DATE:</strong>  
         <input type=\"text\" name=\"mRelease\" size=\"40\" maxlength=\"100\" value=\"" .$row["release_date"]. "\"/><p />
         <strong>IMAGE NAME:</strong>    
         <input type=\"text\" name=\"imgName\" size=\"40\" maxlength=\"100\" value=\"" .$row["images"]. "\" /><p />
         <strong>MOVIE RATING:<strong>
         <input type=\"text\" name=\"mRelease\" size=\"40\" maxlength=\"100\" value=\"" .$row["ratings"]. "\" /><p />
         <strong>MOVIE DESCRIPTION:</strong><br />
                         <textarea rows=\"10\" cols=\"40\" name=\"mDescrp\" wrap=\"physical\">" .$row["description"]."</textarea>
         <hr /></form>
         </div>");   
   }

What's with the <p />s? HTML paragraphs are supposed to have content.

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.