Jump to content

PHP & SQL Form Issue


khristian

Recommended Posts

Hi people,

 

I use a PHP form to store information in an SQL database, this al works fine until I try and pull the information back.

 

When I enter the information in a textarea box it is then stored in a 'text' field in the database.

 

When I pull it back I use:

 

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0">'.$row['issue'].'</td>';

 

Okay so this does pull back the information, but it does not include line breaks, so for example if I stored this post in my database then I would just get it all back as one line, even though when I use phpmyadmin I can see the text box with the empty lines.

 

Any ideas?

 

 

Link to comment
https://forums.phpfreaks.com/topic/97162-php-sql-form-issue/
Share on other sites

Cheers, but how would I put that into effect.

 

My full code at the moment is:

 

<?

$sql = "SELECT * FROM status WHERE recordid = '$issuenumber';";

$result = mysql_query($sql);

{

while($row = mysql_fetch_array($result)) {

            print '<table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0">';

            print ' <tr>';

            print ' <td width="40%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"><b>Issue affecting:</b></td>';

            print ' <td width="60%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0">'.$row['affecting'].'</td>';

            print ' </tr>';

            print ' <tr>';

            print ' <td width="40%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"> </td>';

            print ' <td width="60%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"> </td>';

            print ' </tr>';

            print ' <tr>';

            print ' <td width="40%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"><b>Issue description</b></td>';

            print ' <td width="60%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0">'.$row['issuetitle'].'</td>';

            print ' </tr>';

            print ' <tr>';

            print ' <td width="40%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"><b>Issue details</b></td>';

            print ' <td width="60%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0">'.$row['issue'].'</td>';

            print ' </tr>';

            print ' <tr>';

            print ' <td width="40%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"> </td>';

            print ' <td width="60%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"> </td>';

            print ' </tr>';

            print ' <tr>';

            print ' <td width="40%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"><b>Reported to:</b></td>';

            print ' <td width="60%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0">'.$row['reportedto'].'</td>';

            print ' </tr>';

            print ' <tr>';

            print ' <td width="40%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"><b>Reported:</b></td>';

            print ' <td width="60%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0">'.$row['reporteddate'].' @ '.$row['reportedtime'].'</td>';

            print ' </tr>';

            print ' <tr>';

            print ' <td width="40%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"> </td>';

            print ' <td width="60%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"> </td>';

            print ' </tr>';

            print ' <tr>';

            print ' <td width="40%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"><b>Estimated repair date:</b></td>';

            print ' <td width="60%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0">'.$row['fixdate'].'</td>';

            print ' </tr>';

            print ' <tr>';

            print ' <td width="40%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"> </td>';

            print ' <td width="60%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"> </td>';

            print ' </tr>';

            print ' <tr>';

            print ' <td width="40%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0"><b>Status:</b></td>';

            print ' <td width="60%" valign="top">';

            print ' <p class="main" style="margin-top: 0; margin-bottom: 0">'.$row['status'].'</td>';

            print ' </tr>';

 

            print '</table>';

    }

}

  ?> 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/97162-php-sql-form-issue/#findComment-497210
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.