Jump to content

Recommended Posts

<?php

 

$trainer = $_POST['reportname'];

$workshop = $_POST['workshopname'];

 

$con = mysql_connect("localhost", "admin", "");

if (!$con) {

  die('Not connected : ' . mysql_error());

  }

 

mysql_select_db("evaluationform",$con);

 

$report = mysql_query("SELECT * FROM evaluation where trainer like '$trainer%'and workshop like '$workshop'ORDER BY q1");

 

    if (!$report)

{

      echo("<b>Error performing query: " . mysql_error() . "</b>");

      exit();

}

 

  print "  |q1 |    q2 |    q3 |    q4 |    q5

              |   q6      |    q7 |    q8 |    q9 

              |   q10    |    q11|    q12|    q13";

/*here is my problem question 1-11 are just numbers so they fit fine in this schema however, question 12 and 13 and textboxes therefore when people write more than a couple of characters the whole table get mess up. What I need is some way to display the data in a very elagant fashion. I been experimenting with while statements and tables but is quite difficult I just need some hints and examples if at all possible. */

   

 

while ($row = mysql_fetch_array($report))

{

        $question1 = $row["q1"];

        $question2 = $row["q2"];

        $question3 = $row["q3"];

        $question4 = $row["q4"];

        $question5 = $row["q5"];

        $question6 = $row["q6"];

$question7 = $row["q7"];

$question8 = $row["q8"];

$question9 =$row["q9"];

$question10 =$row["q10"];

$question11 =$row["q11"];

$question12 =$row["q12"];

$question13 =$row["q13"];

 

print("

<table>

<tr>

<td> $question1 </td>

<td>         $question2 </td>

<td>         $question3 </td>

<td>         $question4 </td>

<td>         $question5 </td>

<td>         $question6 </td>

<td>         $question7 </td>

<td>         $question8 </td>

<td>         $question9 </td>

<td>         $question10 </td>

<td>         $question11 </td>

<td>         $question12 </td>

<td>         $question13 </td>

 

 

</tr>

</table>");

 

 

}

    print("<br><br>");

print("

<td>         The evaluation of this trainer:$trainer</td><br>

<td>         Regarding this workshop: $workshop</td>");

 

?>

Link to comment
https://forums.phpfreaks.com/topic/68517-php-form-displaying-data-correctly/
Share on other sites

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.