Jump to content

ee

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ee's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I seem to have got it working with original code now! Thanks for help everyone!
  2. I still only get one line of records from text file in a table..it does not produce a second table for 2nd line of text file??
  3. If i have a text file with lines of code submitted: whilst i can break it line by line in a table...Is it possible to load each upload from the txt file into a new table???? e.g. <? $test = file("details.txt"); $number_of_adverts = count($test); if ($number_of_adverts == 0) { echo "<p>No Adverts currently</p>"; } echo "<table width = '40%' border=0 bgcolor = \"#000000\"> \n"; for ($i=0; $i<$number_of_adverts; $i++) $line = explode ( "\t", $test[$i] ); { echo "<tr><th align = 'left'>First Name</td><td align = 'left'>$line[0]</td></tr> <th align = 'left'>Surname</td><td>$line[1]</td></tr> <tr><td><br></td><td></td></tr> <th align = 'left'>Phone No</td><td>$line[2]</td></tr> <tr><td><br></td><td></td></tr> <th align = 'left'>Position Type</td> <td>$line[3]</td></tr> <tr><td><br></td><td></td></tr> <th align = 'left'>Details</td><td>$line[4] </td></tr> <tr><td><br></td><td></td></tr> <th align = 'left'>Education</td><td>$line[5]</td></tr> <tr><td><br></td><td></td></tr> <th align = 'left'>Time of Day to Contact</td><td>$line[6]</td> <tr><td><br></td><td></td></tr> <tr><td><br></td><td></td></tr> </tr>"; } echo "</table>"; ?> so, every line of record in the tetx file creates a new table down the screen??? Currently..this is only showing one of the lines from the text file????
  4. str_replace worked a treat, for some reason textarea code didnt, but no bother...thankyou very much!
  5. I have a html form that submits results to a text file. This is then opened and read into a table producing a new line for each post in an new page. My problem is when a user hits enter in the textarea (Details) on the initial form, this seriously throws out my table when reading the results from the text file, spreading the lines from the 'details' textarea in diff cells of the table. If the user doesnt hit enter in the initial textarea there is no problem on the initial textarea. CAN ANYBODY HELP ME!?!? $myFile = "details.txt"; $fh = fopen($myFile, 'a') or die("can't open file"); $stringData = $fname. "\t".$lname. "\t".$phone. "\t".$positiontype. "\t".$details. "\t".$education. "\t".$TofD."\n"; fwrite($fh, $stringData); fclose($fh); and then it is placed in table line by line: echo "<table border=1 bgcolor = \"#000000\" bordercolor = \"#333333\"> \n"; echo "<tr><th>First Name</td> <th>Surname</td> <th>Phone No</td> <th>Position Type</td> <th>Details</td> <th>Education</td> <th>Time of Day to Contact</td> </tr>"; for ($i=0; $i<$number_posts; $i++) { //split the lines $line = explode ( "\t", $test[$i] ); echo "<tr><td>$line[0]</td> <td>$line[1]</td> <td>$line[2]</td> <td>$line[3]</td> <td>$line[4]</td> <td>$line[5]</td> <td>$line[6]</td> </tr>"; } echo "</table>"; ?>
×
×
  • 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.