Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.