Jump to content

Can anyone tell me why I'm getting white space?


music_lp90
 Share

Recommended Posts

Hi, I've created a form to edit entries that have been made with another form that is identical, except the other adds profiles to a mysql database and this one edits the data that has been entered.In order to allow the user to edit the information, I am pre populating the form with the data from mysql.All of the text inputs load the data fine, but the textarea inputs insert about a line and a half of white space at the beginning. This isn't too much of a problem, because on the update sql statement that is inserting the data back into mysql, I am using ltrim() to clear the white space on the left. But it is annoying and confusing to the user to have this white space at the beginning of every textarea. I've tried using ltrim on the variables that are prepopulating the form, but it didn't remove the white space.Here's the edit form:

<?php 	$id = $_POST['id'];	$query = mysql_query("SELECT * FROM profiles WHERE id = '$id'");	while ($result = mysql_fetch_array($query)) {			$position = $result['position'];			$name = $result['name'];			$phone = $result['phone'];			$email = $result['email'];			$title1 = $result['title1'];			$title2 = $result['title2'];			$title3 = $result['title3'];			$title4 = $result['title4'];			$title5 = $result['title5'];			$title6 = $result['title6'];			$content1 = $result['content1'];			$content2 = $result['content2'];			$content3 = $result['content3'];			$content4 = $result['content4'];			$content5 = $result['content5'];			$content6 = $result['content6'];	} ?>	<form  action="profile_edit_update.php" method="post" enctype="multipart/form-data">		<label class="content">Position (Pastor, Secretary...): <input type="text" name="position" 		value="<?php echo $position; ?>" />		</label><br />				<label class="content">Name (First and Last): <input type="text" name="name" 		value="<?php echo $name; ?>" />		</label><br />				<label class="content">Phone: <input type="text" name="phone" value="<?php echo $phone; ?>" /></label><br />				<label class="content">E-mail: <input type="text" name="email" value="<?php echo $email; ?>" /></label><br />				<hr />						<p><em>Suggested title for this section is Bio or Background</em></p>										<label class="content">Title heading 1: <input type="text" name="title1" 			value="<?php echo $title1; ?>" /></label><br />						<label class="content">Answer or comments: <textarea name="content1" rows="12" cols="60">			<?php echo $content1; ?></textarea></label><br />			<hr />								<p><em>Suggested title is family</em></p>				<label class="content">Title heading 2: <input type="text" name="title2" 				value="<?php echo $title2; ?>" /></label><br />								<label class="content">Answer or comments: <textarea name="content2" rows="7" cols="60">				<?php echo $content2; ?></textarea></label><br />				<hr />										<p><em>Suggested title is How many years at LBC?</em></p>					<label class="content">Title heading 3: <input type="text" name="title3" 					value="<?php echo $title3; ?>" /></label><br />										<label class="content">Comments, statement or story for Title 3: <textarea name="content3" rows="3" cols="60">					<?php echo $content3; ?></textarea></label><br />					<hr />												<p><em>Suggested title is Favorite Food</em></p>						<label class="content">Title heading 4: <input type="text" name="title4" 						value="<?php echo $title4; ?>" /></label><br />												<label class="content">Comments, statement or story for Title 4: <textarea name="content4" rows="3" cols="60">						<?php echo $content4; ?></textarea></label><br />						<hr />														<p><em>Suggested title is Hobbies/Interests</em></p>							<label class="content">Title heading 5: <input type="text" name="title5" 							value="<?php echo $title5; ?>" /></label><br />														<label class="content">Answer or comments: <textarea name="content5" rows="5" cols="60">							<?php echo $content5; ?></textarea></label><br />							<hr />																<p><em>Suggested title is Favorite LBC Moment</em></p>								<label class="content">Title heading 6: <input type="text" name="title6" 								value="<?php echo $title6; ?>" /></label><br />								<label class="content">Comments, statement or story for Title 6: <textarea name="content6" rows="5" cols="60">								<?php echo $content6; ?></textarea></label><br />								<hr />																		<p><em>The main profile picture should be a picture of only the person the profile is for. Probably should be a headshot.</em></p>									<p><em>The second picture is optional, but could be a family picture, one that shows the personality of the person, one from a church event, or some other picture that seems appropriate.</em></p>									<label class="content">Main Profile Picture: <input type="file" name="image1"></input></label><br />									<label class="content">Picture 2: <input type="file" name="image2"></input></label>									<br /><hr />										<!--Hidden input is to identify where to update in mysql-->										<input type="hidden" name="id" value="<?php echo $id; ?>" />										<input type="submit" name="submit" value="Submit Profile"></input>	</form>

Thanks for any help, if you need to see any of the other parts of the code, like when I'm adding the profile for the first time or anything, just let me know.

Link to comment
Share on other sites

Things inside the textarea tags are printed verbatim onto the page, and in your code there are a lot of tabs. These will appear inside the textarea. Just compress your code onto one line

<label class="content">Answer or comments: <textarea name="content1" rows="12" cols="60"><?php echo $content1; ?></textarea></label><br />

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...