php

R

realtyonegroup

I have Expression Web and created a PHP page but it doesn't seem to be
displaying. I published it at:

http://www.newhollandrochester.com/quotes.php

The code is just a test that I'm doing (I'm new to PHP):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Experimenting with quotes</title>
</head>

<body>
<?php
$name = 'David Powers';
echo 'Single quotes: The author is $name<br />';
echo "Double quotes: The author is $name";
?>
</body>
</html>

Can someone tell me why nothing is being displayed? Thanks
 
A

Andrew Murray

I'm no expert in PHP or programming generally, but I believe your syntax is
incorrect. To write (echo) the line including the value of the variable
with single quotes, you have to separate the text from the variable like so:

echo 'This persons name is', $name;

(note the single quote after the word "is" followed by a comma and $name;
(with no quotes) and terminated with the semi colon.

See this example: http://www.murraywebs.com/testPHP.php to demonstrate.
The double quotes method works the way you have written it, but for some
reason the code doesn't execute on the URL you give below. I think this is
because your host doesn't support PHP.

I just see the HTML/PHP code printed out on the screen but if you view it
here: http://www.murraywebs.com/quotes.php it runs OK - I just copied/pasted
it to a EW PHP page, and published to my host, and it works fine.

I'd check with your host that you can actually run PHP scripts.
 
T

Tom Willett

In addition to the other replies, you may wish to post in the Expression
newsgroup.

--
Tom [Pepper] Willett
Microsoft MVP - FrontPage Since 1997
---------------------------
:I have Expression Web and created a PHP page but it doesn't seem to be
: displaying. I published it at:
:
: http://www.newhollandrochester.com/quotes.php
:
: The code is just a test that I'm doing (I'm new to PHP):
:
: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
: <html xmlns="http://www.w3.org/1999/xhtml">
: <head>
: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
: <title>Experimenting with quotes</title>
: </head>
:
: <body>
: <?php
: $name = 'David Powers';
: echo 'Single quotes: The author is $name<br />';
: echo "Double quotes: The author is $name";
: ?>
: </body>
: </html>
:
: Can someone tell me why nothing is being displayed? Thanks
 
R

realtyonegroup

Hey everyone,

I contacted my service provider and he said that they support php, but he
didn't realize it was turned off by default. Anyways, I figured it was
something I was doing wrong but it seems that all is well. I realized right
after I made my post that this was a FrontPage forum (which I generally use)
so sorry for the misplaced post. Anyways, thanks a bunch for the help. Very
much appreciated!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top