Linebreak in mySQL

I have one form which adds data to mysql and one form on another page which retrieves the data and autofills the forms textboxes.
This works but only as long as the data in my db doesn’t contain any linebreaks, why is that?

I’m using this code and calls FillForm and it works for all except $data[‘long_description’] which have linebreaks in it, the data type for all of them is TEXT

	function FillForm($id)
		$app = mysql_query("SELECT short_description, long_description, whats_new, screen1, screen2, screen3, screen4 FROM cs_applications, cs_screens WHERE{$id} &&");
		$data = mysql_fetch_array($app);
		echo "<script>
						addText(document.form1.screen1, '{$data['screen1']}');
						addText(document.form1.screen2, '{$data['screen2']}');
						addText(document.form1.screen3, '{$data['screen3']}');
						addText(document.form1.screen4, '{$data['screen4']}');
						addText(document.form1.short_desc, '{$data['short_description']}');
						addText(document.form1.long_desc, '{$data['long_description']}');
<script language="Javascript" type="text/javascript">
	function addText(textbox, text )
		textbox.value = text;
addText(document.form1.long_desc, '{$data['long_description']}');

For one, I see you using single quotes for both the script value and the PHP array key. Make either of them doublequotes and see if that changes anything.

Sponsor our Newsletter | Privacy Policy | Terms of Service