...

View Full Version : need to make more collumns with php



sorlaker
03-29-2010, 12:06 PM
hi guys i'd glad with someone help me to figure out how to output another collumn on my code well this is the code thanks!

<?php
$uploaddir = 'txt/';
$uploadfile = $uploaddir . basename($_FILES['teext']['name']);



echo '<pre>';
if (move_uploaded_file($_FILES['teext']['tmp_name'], $uploadfile)) {
echo "<h2>UPADO DE BOOOUA, o arquivo ta na pasta txt!\n</h2>";
} else {
echo "<h2>Tem algum erro no arquivo TXT aí doido!\n</h2>";
}
//echo 'Info pra DEBUG:';
//print_r($_FILES);
print "</pre>";

$arquivo = $uploadfile;
//$arquivo = $_FILES['teext']['tmp_name'];
//$arquivo = $_POST['arquivo'];
//$epi = file( 'txt/'.$arquivo );
$epi = file( $arquivo );


$a=1;
echo '<table width="75px" border="1px" style="border-collapse:collapse;">
<tbody>
<tr style="background-color: rgb(172, 201, 235);">
<td><strong>MKV</strong></td>
</tr>';
foreach ($epi as $key => $value)
{
$epi[$key] = array();

$epi[$key] = explode(" ", $value);


// The following will output: Episode 1

echo '<tr><td>'; // start row
echo '<a target="_blank" href='.$epi[$key][0].'>Episode '.$a++.'</a>';
echo '</td></tr>'; // end row

}

echo '</table>'; // end table..
?>

now how can i make another collumn for another txt file?
outputing two collumns like MKV and RMVB
thanks:D

tomws
03-29-2010, 03:20 PM
Is this a trick question? You just echo another td pair.

echo '<table width="75px" border="1px" style="border-collapse:collapse;">
<tbody>
<tr style="background-color: rgb(172, 201, 235);">
<td><strong>MKV</strong></td>
<!-- -->
<td>Something Else</td>
<!-- -->
</tr>';
foreach ($epi as $key => $value)
{
$epi[$key] = array();

$epi[$key] = explode(" ", $value);


// The following will output: Episode 1

echo '<tr>'; // start row
echo '<td><a target="_blank" href='.$epi[$key][0].'>Episode '.$a++.'</a></td>';
/**/
echo '<td>more stuff</td>';
/**/
echo '</tr>'; // end row

}

echo '</table>'; // end table..

sorlaker
03-29-2010, 05:57 PM
hsuhashas sorry

but i need to make another foreach links like


echo '<table width="75px" border="1px" style="border-collapse:collapse;">
<tbody>
<tr style="background-color: rgb(172, 201, 235);">
<td><strong>MKV</strong></td>
<!-- -->
<td>Something Else</td>
<!-- -->
</tr>';
foreach ($epi as $key => $value)
{
$epi[$key] = array();

$epi[$key] = explode(" ", $value);


// The following will output: Episode 1

echo '<tr>'; // start row
echo '<td><a target="_blank" href='.$epi[$key][0].'>Episode '.$a++.'</a></td>';
/**/
echo '<td><a target="_blank" href='.$another txt epi[$key][0].'>Episode '.$a++.'</a></td>';
/**/
echo '</tr>'; // end row

}

echo '</table>'; // end table..


with that whre can i put another foreach?

tomws
03-29-2010, 06:16 PM
I don't understand what you're saying. I'm guessing that you mean you'd like to create table rows with cells populated from multiple arrays. There are several ways to do that. It would probably be easiest to use a new array that is a combination of the others so that the foreach loop is as simple as before.

sorlaker
03-30-2010, 04:10 AM
i got it thanks a lot!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum