Jump to content

[SOLVED] Echo Function


pengu

Recommended Posts

Hey guys,

 

Question about the echo function.  I'm putting some HTML within the variable.  Having trouble with the javascript so the codes with the " " and I'm using ' ' for anything else, but then I run into the problem of javascript using ' ' within " " tags.

 

The $message is used in an echo statement further down the page.  Is there a way around this?

 

<?php

session_start();

if ($_SESSION['logged_in'] == false) {

$message="<div class='login'><form id='login-form' method='post' action='login.php'><fieldset><h2>Login to Web Site</h2><p>Username:   <input type='text' name='username' id='username' size='17' /></p><p>Password:   <input type='password' name='password' id='password' size='17'/></p><input type='submit' name='submit' id='submit' value='Login' /></fieldset></form></div>" ;
}
else
{
$message="<div class='login'><div id='login-form'><fieldset><h2>Welcome " . $_SESSION['username'] . "</h2><p><a href='javascript:popUp(email.php)'>Email</a>   <a href='logout.php'>Logout</a></p></fieldset></div></div>" ;
} 
?>

Link to comment
https://forums.phpfreaks.com/topic/164893-solved-echo-function/
Share on other sites

Umm this is where the problem is, I forgot to fix this up before.

It only displays javascript:popUp( when you hover over it.

 

<?php

echo "<a href='javascript:popUp('email.php')'>Email</a>";

?>

 

edit: Just went over what you said, I will try it.

Edit2: thank you so much seventheyejosh, it worked a treat.

 

Link to comment
https://forums.phpfreaks.com/topic/164893-solved-echo-function/#findComment-869532
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.