i need some help please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
oxo
Forum Newbie
Posts: 2
Joined: Sun Mar 28, 2004 7:50 am
Location: london

i need some help please

Post 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.
litebearer
Forum Contributor
Posts: 194
Joined: Sat Mar 27, 2004 5:54 am

Post 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...
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post 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>';
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post 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.. :)
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

you can escape chracters so u can use you " ", heres how:
<input type=submit Value="\Click me Babyyyyyy\">
oxo
Forum Newbie
Posts: 2
Joined: Sun Mar 28, 2004 7:50 am
Location: london

hi

Post 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 ?
Last edited by oxo on Wed Mar 31, 2004 10:36 am, edited 1 time in total.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post 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
Post Reply