Forum Moderators: coopster

Message Too Old, No Replies

how to use echo-php in the html

         

Flolondon

2:14 pm on Mar 16, 2006 (gmt 0)

10+ Year Member



please some one help. I want to pass the variables neatly in the below coloured boxes... how do I execute such using echo function.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="776" border="1">
<tr>
<td width="197">Name</td>
<td width="563" bgcolor="#00FFFF">&nbsp;</td>
</tr>
<tr>
<td>Address</td>
<td bgcolor="#006699">&nbsp;</td>
</tr>
<tr>
<td>Comments</td>
<td bgcolor="#00CCFF">&nbsp;</td>
</tr>
<tr>
<td>Delivery</td>
<td bgcolor="#006699">&nbsp;</td>
</tr>
<tr>
<td>Meals</td>
<td bgcolor="#00FFCC">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td bgcolor="#006699">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td bgcolor="#00CCFF">&nbsp;</td>
</tr>
</table>
</body>
</html>

jatar_k

2:27 pm on Mar 16, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what variables?
from where?

the echo itself is straight forward, it would be something like

<td bgcolor="#00CCFF"><?php echo $myvariable;?></td>

le_gber

12:06 pm on Mar 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



don't forget to save your page as .php

if you have a form on the previous page the target of the form should be the name of this page.

pagewithform.htm:

...
<form target="pagewithtable.php" method="post">
...

followed by your form fields

...

</form>

pagewithtable.php
<?php
if(isset($_POST['formfieldname'])){
$myvar=$_POST['formfieldname'];
}

...

repeat this as many times as you have variables
?>
<html>
<head>
...
<tr>
<td>delivery</td>
<td><?php echo $mydeliveryvar;?></td>
</tr>

...

hope this helps

NameNick

1:30 pm on Mar 17, 2006 (gmt 0)

10+ Year Member



Hi,

There is also the shorter format

<td bgcolor="#00CCFF"><?= $myvariable?></td>

It requires the php.ini directive short_open_tag = on which have most of the servers.

NN