Friday, 15 August 2014

html - Embedding php script into an href that is already embedded into a php script -



html - Embedding php script into an href that is already embedded into a php script -

i have next code, , entire page. frustrated because cannot find finish illustration while researching on web, spinets not answering question.

the section of code troubling line show below:

echo "<p><a style=\"font-size:40px; font-family:segoe script bold; color:green\" href="<?php echo $web_path; ?>">mail server</a></p>";

and more part of it:

href="<?php echo $web_path; ?>"

the entire php page shown below:

<?php include 'debug.php'; // remember later. // header('content-type: application/force-download'); session_start(); $username = $_session["fusername"]; $password = $_session["fpassword"]; $web_path = $_server['document_root'] . "/userpages/mail_login.html"; if ($username === "name_of_user") { echo "<!doctype html> <html lang=\"en-us\"> <head><title> title text goes here </title></head> <!-- comments --> <body> <h6><center> company name text goes here </center><br><h6>"; echo "<center><p style=\"font-size:80px; font-family:segoe script bold\"><span style=\"color:blue\"> first name</span><span style=\"color:red\"> lastly name</span></p></center>"; echo "<p><a style=\"font-size:40px; font-family:segoe script bold; color:green\" href=\"get_dir_lists.php\">directory listing</a></p>"; echo "<p><a style=\"font-size:40px; font-family:segoe script bold; color:green\" href="<?php echo $web_path; ?>">mail server</a></p>"; echo "<center><p ><a style=\"font-size:40px; font-family:segoe script bold; color:yellow\" href=\"/login.html\">return login screen</a></p></center>"; echo "</body></html>"; } else { echo "ain't workin"; } ?>

my question is: how embed php script href embedded php script (or page)?

i know close way have quotes or missing concatenating dots not right. closing ?> @ end of page not beingness recognized php closing statement.

for other readers need see more simplified illustration have cutting out of unnecessary code below entire php page simplified few lines improve viewing , clarity:

<?php echo "<p><a href="<?php echo $web_path; ?>">mail server</a></p>"; ?>

the reason because you're within php , using sec echo plus you're not escaping other double quotes.

echo "<p><a href="<?php echo $web_path; ?>">mail server</a></p>"; ^^^^^^^^^^^ ^ ^^^

change

echo "<p><a href=\"$web_path\">mail server</a></p>";

or more specifically:

echo "<p><a style=\"font-size:40px; font-family:segoe script bold; color:green\" href=\"$web_path\">mail server</a></p>";

having error reporting on, have thrown:

parse error: syntax error, unexpected '?'...

something either not using, or haven't shared (parse) error.

add error reporting top of file(s) help find errors.

<?php error_reporting(e_all); ini_set('display_errors', 1);

sidenote: error reporting should done in staging, , never production.

alternate methods:

echo '<p><a href="'.$web_path.'">mail server</a></p>';

or

echo "<p><a href='$web_path'>mail server</a></p>";

php html

No comments:

Post a Comment