Old 01-05-2007, 11:24   1 links from elsewhere to this Post. Click to view. #1 (permalink)
pagey
Resident Cheese Expert
 
pagey's Avatar
 
Join Date: Aug 2006
Location: South Wales
Posts: 512
HTML within PHP

I'm having a little trouble with this. It keeps throwing up an error, so I'm obviously doing something wrong.


I'm simply trying to get an echo statement working with a class named "text".

Here is the code:
PHP Code:
<?php 
include ("header.html");

$user 'neil'// set the required 
$pass 'password'// username and password 

if($user == $_POST['username'] && $pass == $_POST['password']) 

    echo 
'Welcome  '.$_POST['username']. "<br>";
    echo 
'click here to go to the <a href="index.php">members</A> area'

else 

    echo 
"Invalid username/password !<br>"// Display this if the username/password were wrong.
echo 'Click <a href="login.html">here</A> to try again';



include (
"footer.html");
?>

Now I want all of the echo statement to be part of a class named "text".

I've tried
HTML Code:
"<p class=\"text\">stuff and nonsense</P>"

But it keeps telling me that something is wrong.

How should I be going about this?

Cheers
  Reply With Quote
Old 01-05-2007, 11:28   #2 (permalink)
R1gM
Senior Member
 
R1gM's Avatar
 
Join Date: Sep 2006
Posts: 275
firstly this bit:
Code:
echo 'Welcome '.$_POST['username']. "<br>";

Has two different types of quotations. Change "<br/>" to '<br/>' but if your problem is the second bit then what error is it spitting out?

Also you only need to escape the quotations if you are using double quotes for the echo statement.

Remember you could also simply go for

PHP Code:
<?php if($someargument=='yes'){?>
<p class="text">This is normal html</p>
<?php }?>

of course echo should be working anyways
  Reply With Quote
Old 01-05-2007, 12:07   #3 (permalink)
TheSteed
Registered User
 
Join Date: May 2007
Posts: 3
You may want to learn a bit about security as well
  Reply With Quote
Old 01-05-2007, 13:13   #4 (permalink)
pagey
Resident Cheese Expert
 
pagey's Avatar
 
Join Date: Aug 2006
Location: South Wales
Posts: 512
Quote:
Originally Posted by TheSteed
You may want to learn a bit about security as well

Oh don't worry, I know this is a pathetic login system, but its for a Uni assignment, and its the one they showed us as an example to use, so it should suit my needs.

I'll have a look at the above and see if I can make it work.

Cheers
  Reply With Quote
Reply


LinkBacks (?)
LinkBack to this Thread: http://www.designerstalk.com/forums/programming/25887-html-within-php.html
Posted By For Type Date
HTML within PHP This thread Refback 05-05-2007 14:37

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8