Jump to content

Recommended Posts

Hi all,

 

I realised as users register themselves in the registration form, they wrote their comments and experience in the comment box which was provided

 

Example (this is the content which they have written)

'Sentence 1 - Abccafsafsafafasdfafasfafs

 

Sentence 2 - dasddsadsadsadsdaddsda'

 

 

As you can see, between Sentence 1 and 2 there is a break (space).

However when we store it in our database, and generate it out as a webpage, the break (space) is gone, and sentence 1 and 2 merged

 

Example

'Abccafsafsafafasdfafasfafsdasddsadsadsadsdaddsda'

 

My question is, how can we prevent 2 different sentences from merging? Thanks

 

Below is my code and attached it what has been generated after we have posted it in webpage

 

 

cho '<div id="panel3">';
	echo '<table>';
	/***Tutor's Comments***/
		echo'<div id="tutor_comments">';
			echo '<br/><tr><td class="row_header">Tutor\'s Comments</td></tr>';
			if (!empty($row2['tutor_comments'])) {
				echo '<tr><td>' . $row2['tutor_comments'] . '<br/><br/></td></tr>';
			}
	/***Tutor's Commitments***/
			echo '<tr><td class="row_header">Tutor\'s Commitment</td></tr>';
			if (!empty($row2['tutor_commitment'])) {
				echo '<tr><td>' . $row2['tutor_commitment'] . '<br/><br/></td></tr>';
			}		
	/***Admin_comments***/
			echo '<tr><td class="row_header">Admin\'s Comments</td></tr>';
			if (!empty($row2['admin_comments'])) {
				echo '<tr><td>' . $row2['admin_comments'] . '<br/><br/></td></tr>';
			}

	echo '</table>'; //End of Panel 3's table
		echo '</div>'; //End of tutor_comments DIV

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/224489-no-break-in-between-different-sentences/
Share on other sites

I can see in your example code what you're trying to show as the problem, but I can't see the problem in the screenshot? Also, why are you mixing tables and div's? It makes ur code look pretty confusing, and I'm not sure why you would want to use them both?

 

Denno

Hi everyone,

 

Maybe I didn't explain myself clearly.

 

Currently we have a registration form for tutors to sign up, as they had completed signing up, their Profiles will be shown in our website, however we have an issue here, when tutors write their 'experiences' in the comments box, with break lines, the break lines could not execute.

 

As you can see in the attachment (registration_form.jpg), when tutor types,

 

I am a boy.

 

I am a boy.

 

I am a boy.

 

//As you can see, the line break in the 2nd and 3rd sentence, however as their profile appear in our website, it does not execute the break lines, instead it shows

 

I am a boy.I am a boy.I am a boy 

 

//Is there a way for the system to understand that there are line breaks in between sentences, and execute exactly what the user has entered?

 

Thanks

 

[attachment deleted by admin]

Hi Pikachu,

 

how should I do it? Is that how I should do it in bold? Thanks

 

/***Tutor's Comments***/

echo'<div id="tutor_comments">';

 

echo 'Tutor\'s Comments<br/>';

if (!empty($row2['tutor_comments'])) {

echo 'nl2br('. $row2['tutor_comments'] . ')<br/><br/>';

}

/***Tutor's Commitments***/

echo 'Tutor\'s Commitment<br/>';

if (!empty($row2['tutor_commitment'])) {

echo 'nl2br(' . $row2['tutor_commitment'] . ')<br/><br/>';

}

/***Admin_comments***/

echo 'Admin\'s Comments<br/>';

if (!empty($row2['admin_comments'])) {

echo '' . $row2['admin_comments'] . '<br/><br/>';

}

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.