Page 1 of 1

i need some help please

Posted: Sun Mar 28, 2004 7:50 am
by oxo
can any one tell me how to create a table using php codes?

to change from html to php for e.g

<table>
<tr>
<td>asdsd</td>
</tr>
<tr>
<td>asdsd</td>
</tr>
</table>

what i need to know is that how can i change that in php code? if any one knows or can give me some help please just post thank you.

Posted: Sun Mar 28, 2004 8:25 am
by litebearer
The easiest way is to start & stop the php. ie

<?PHP

... some php coding

?>

do you html coding here (your table for instance)

<?PHP

somemore php coding

?>
--------------

you can even include some php within the html table. ie


<TD>
<?PHP
echo $somevariable;
?>
</TD>


hope that helps.

Lite...

Posted: Sun Mar 28, 2004 8:53 am
by Steveo31
Check around here

viewtopic.php?t=19006&postdays=0&postorder=asc&start=30

But the way one does it is

echo '<table>';
echo '<tr><td>';
echo '$data';
echo '</td></tr>';
echo '</table>';

Posted: Sun Mar 28, 2004 9:19 am
by d3ad1ysp0rk

Code: Select all

echo <<<EOT
<table> 
<tr> 
<td>asdsd</td> 
</tr> 

<tr> 
<td>asdsd</td> 
</tr> 
</table> 
EOT;

Code: Select all

echo "<table> 
<tr> 
<td>asdsd</td> 
</tr> 
<tr> 
<td>asdsd</td> 
</tr> 
</table>";

Code: Select all

echo "<table>";
echo "<tr>"; 
echo "<td>asdsd</td>"; 
echo "</tr>";
echo "<tr>";
echo "<td>asdsd</td>"; 
echo "</tr>";
echo "</table>";

Code: Select all

echo '<table> 
<tr> 
<td>asdsd</td> 
</tr> 
<tr> 
<td>asdsd</td> 
</tr> 
</table>';

Code: Select all

echo '<table>';
echo '<tr>';
echo '<td>asdsd</td>'; 
echo '</tr>'; 
echo '<tr>'; 
echo '<td>asdsd</td>'; 
echo '</tr>'; 
echo '</table>';

Code: Select all

$variable = "<table> \n<tr> \n<td>asdsd</td> \n</tr> \n<tr> \n<td>asdsd</td> \n</tr> \n</table>";
echo $variable;

and I bet there's more.. :)

Posted: Sun Mar 28, 2004 11:07 am
by tim
you can escape chracters so u can use you " ", heres how:
<input type=submit Value="\Click me Babyyyyyy\">

hi

Posted: Wed Mar 31, 2004 9:41 am
by oxo
thanks that's very helpful. but now it's the trouble that a wanted to make the language i mean to work with language's as well let's say that for example i need to do this.

Code: Select all

<?php
echo "
<table> 
  <tr>
   <td>
 Click here to go "_.HOME."  

or 

Scattisi qui per andare "_.HOME."
   </td>
 </tr>
</Table>"
?>
So to users it will be some thing like:

Click here to go Home ( this is if the language selected is English)


Scattisi qui per andare [ u] indice[/u ] ( this is how it would look like if language selected is Italian).

so all i want to know is that how can i make this work .
i have created a file and named it in italian-language.php
and i typed this

Code: Select all

<?php

define("_ICQ","Numero del ICQ");
define("_AIM","Numero del AIM");
define("_YIM","Numero del YIM");
define("_MSNM","Numero del MSNM");
define("_HOME","Indice");
?>
but it doe not work some thing is wrong and i'm a bigginner so i would like some help please if u can help me ?

Posted: Wed Mar 31, 2004 9:50 am
by JayBird
oxo, please put [syntax=php][/syntax] tags around your code so the forum highlights it for you. Much easier for everyone to read this way.

Thanks

Mark