Solved

PHP Code Help Neded

Posted on 2014-07-21
4
261 Views
Last Modified: 2014-07-21
The code below is displayed as part of a script. I'm trying to get "To go to the main page click here" to be the bottom line but keep getting  an error on this line that says "Parse error; unexpected T_STRING, expecting ',' or ';'

Can someone help me out.....I can't figure it out...I think I've looked at it too long. lol, thanks

echo "<p><center><h2>My Office</h2></center></p>";
echo "<p><h3><center>Office Three</center></h3></p>";
echo "<center>An email has been sent to the person who made this assignment notifying them it is complete."; 
echo "<center>To go to the main page <a href="http://mysite/flow/index.html">click here</a>.</b></i></p></center>

Open in new window

0
Comment
Question by:wantabe2
  • 2
4 Comments
 
LVL 21

Accepted Solution

by:
Randy Poole earned 500 total points
ID: 40209638
echo "<p><center><h2>My Office</h2></center></p>";
echo "<p><h3><center>Office Three</center></h3></p>";
echo "<center>An email has been sent to the person who made this assignment notifying them it is complete."; 
echo "<center>To go to the main page <a href='http://mysite/flow/index.html'>click here</a>.</b></i></p></center>";

Open in new window

0
 
LVL 34

Expert Comment

by:gr8gonzo
ID: 40209639
The problem is this line:
echo "<center>To go to the main page <a href="http://mysite/flow/index.html">click here</a>.</b></i></p></center>

The double-quotes in the link should be escaped, and the line should end with "; like this:

echo "<center>To go to the main page <a href=\"http://mysite/flow/index.html\">click here</a>.</b></i></p></center>";
0
 
LVL 21

Expert Comment

by:Randy Poole
ID: 40209644
You had " inside your " and was missing the "; at the end of the line as well.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40209647
You have nested " in the string - just escape them with \ - or use a single apostrophe to wrap the string

Escaping
echo "<p><center><h2>My Office</h2></center></p>";
echo "<p><h3><center>Office Three</center></h3></p>";
echo "<center>An email has been sent to the person who made this assignment notifying them it is complete."; 
echo "<center>To go to the main page <a href=\"http://mysite/flow/index.html\">click here</a>.</b></i></p></center>";

Open in new window

Using an apostrophe
echo '<p><center><h2>My Office</h2></center></p>';
echo '<p><h3><center>Office Three</center></h3></p>';
echo '<center>An email has been sent to the person who made this assignment notifying them it is complete.'; 
echo '<center>To go to the main page <a href="http://mysite/flow/index.html">click here</a>.</b></i></p></center>';

Open in new window

0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question