Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > PHP help

PHP help
Thread Tools
Mac Enthusiast
Join Date: Oct 2000
Location: Toronto
Status: Offline
Reply With Quote
Nov 17, 2000, 10:53 PM
 
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
Reply With Quote
Nov 18, 2000, 01:58 AM
 
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
Reply With Quote
Nov 18, 2000, 11:15 AM
 
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
Reply With Quote
Nov 18, 2000, 11:27 AM
 
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
Reply With Quote
Nov 18, 2000, 09:14 PM
 
Go ahead and e-mail me a copy of the file and let me look at it. lon@mojomonkey.com
     
bighog
Guest
Status:
Reply With Quote
Nov 21, 2000, 08:02 PM
 
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>
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:44 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2