 |
 |
PHP help
|
 |
|
 |
|
Mac Enthusiast
Join Date: Oct 2000
Location: Toronto
Status:
Offline
|
|
Hello, I'm new to PHP, and I just wanted to try converting a very simple HTML page to PHP. Here is my php page:
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#9795AB" link="#CCCC99" vlink="#FFCC99" text="#FFFFFF">
<?php
echo “<table width="100%" border="0">”;
echo “ <tr bgcolor="#9999CC"> “;
echo “ <td valign="top" height="14" colspan="2">”;
echo “ <div align="center"><font color="#FFFFFF" face="Verdana"><b><u&a mp;gt;testing:</u></b></font>/div>”;
echo “ </td>”;
echo “ </tr>”;
echo “ <tr> “;
echo “ <td colspan="2" valign="top">”;
echo “ <div align="center">”;
echo “ <p><a href="www.macnn.com"><font size="+1">MacNN</font></a></p>”;
echo “ <p><font size="+1"><a href="www.apple.com">Apple</a></font></p>”;
echo “ </div>”;
echo “ </td>”;
echo “ </tr>”;
echo “</table>”;
?>
</body>
</html>
When I run this, I get the following error:
Parse error: parse error, expecting `','' or `';'' in /Library/WebServer/my_sites/mymacnetwork/test.php on line 1
Can anyone help me with this? Right now, all I want to do is know what I need to do to change an existing html page to php. BTW, I did save the above page as a .php. Thanks in advance.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Sep 2000
Location: San Francisco, CA
Status:
Offline
|
|
Well,
You need to either use single quotes in or escape the double quotes. The echo syntax is echo "blahblah";
You are doing echo echo "blah"blah"blah";
So do one of the following:
Escape the quotes inside the function. This will prevent php from parsing the quotes inside the function.
echo “<table width=\"100%\" border=\"0\">”;
Or use single quotes:
echo '<table width="100%" border="0">';
Anyway you probably want to read up on the usage of quotes since they can make a huge impact on the way variables and other code are parsed.
[This message has been edited by lonbaker (edited 11-18-2000).]
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Oct 2000
Location: Toronto
Status:
Offline
|
|
Great, thanks a lot Ionbaker. Did you have any suggested sites? I'm in the process of going through the php manual, on php.org.
Thanks again.....anothermacguy
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Oct 2000
Location: Toronto
Status:
Offline
|
|
Actually, Ionbaker, I'm getting the same message. I replaced my original line:
echo “<table width="100%" border="0">”;
with this:
echo '<table width="100%" border="0">';
and this:
echo “<table width=\"100%\" border=\"0\">”
but I'm still getting this:
Parse error: parse error, expecting `','' or `';'' in /Library/WebServer/my_sites/mymacnetwork/test.php on line 1
Notice anything else?
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Sep 2000
Location: San Francisco, CA
Status:
Offline
|
|
Go ahead and e-mail me a copy of the file and let me look at it. lon@mojomonkey.com
|
|
|
| |
|
|
|
 |
|
 |
|
bighog
|
|
I chabged to code to this and everything worked nicely on my machine.
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#9795AB" link="#CCCC99" vlink="#FFCC99" text="#FFFFFF">
<?php
echo '<table width="100%" border="0">';
echo ' <tr bgcolor="#9999CC"> ';
echo ' <td valign="top" height="14" colspan="2">';
echo ' <div align="center"><font color="#FFFFFF" face="Verdana"><b><u&a mp;gt;testing:</u></b></font>/div>';
echo ' </td>';
echo ' </tr>';
echo ' <tr> ';
echo ' <td colspan="2" valign="top">';
echo ' <div align="center">';
echo ' <p><a href="www.macnn.com"><font size="+1">MacNN</font></a></p>';
echo ' <p><font size="+1"><a href="www.apple.com">Apple</a></font></p>';
echo ' </div>';
echo ' </td>';
echo ' </tr>';
echo '</table>';
?>
</body>
</html>
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|