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
<?php
function FillForm($id)
{
$app = mysql_query("SELECT short_description, long_description, whats_new, screen1, screen2, screen3, screen4 FROM cs_applications, cs_screens WHERE cs_applications.id={$id} && cs_screens.application_id=cs_applications.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>";
}
?>
<script language="Javascript" type="text/javascript">
function addText(textbox, text )
{
textbox.value = text;
}
</script>