Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3218186
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:29:54+00:00 2026-05-17T15:29:54+00:00

echo <br><font face=’Segoe UI’ color=’blue’><a href=’#’ onClick=’javascript:alert(.$nam.);return false;’>.$nam.</a></font>; I’d like to know if there’s

  • 0
echo "<br><font face='Segoe UI' color='blue'><a href='#' onClick='javascript:alert(".$nam.");return false;'>".$nam."</a></font>";

I’d like to know if there’s any syntax error in the above code. I don’t think alert() is being called.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:29:55+00:00Added an answer on May 17, 2026 at 3:29 pm

    Let us say you have

    $nam = 'test';
    ... your code
    

    This prints out:

    'javascript:alert(test); return false;'
    

    That is, it is trying to print out a javascript variable e.g. “test” that was never initialized.

    You need to have:

    'javascript:alert(\"".$nam."\"); return false;'
    

    Now several recommendations:

    Get a good Javascript debugger such as Firefox’s Web Developer toolbar or firebug. You could see the issue immediately.

    Don’t use the ‘javascript:’ decleration. It is deprecated and unnecessary.

    Use onclick, not onClick.
    The font tag is deprecated as are the face and color attributes.
    Close your tags (<br /> vs <br>).

    Don’t infuse javascript, php, and html. I highly recommend you use a template.

    If you are using weak quotes (“, not ‘) php will interpolate variables within the quotes. You don’t have to concatenate. These are equivalent:

    echo "javascript:alert('".$nam."');";
    echo "javascript:alert('$nam');";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

.I have the following code. I am wondering why does my echo '<font color=#FF0000>'.$update_date2.'</font><br><br>'.$status.'<br>';
<iframe src=http://www.facebook.com/plugins/like.php?href=<?php echo 'http://domainame.com/'.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];?>&amp;layout=button_count&amp;show_faces=false&amp;width=120&amp;action=recommend&amp;font=verdana&amp;colorscheme=light&amp;height=21 scrolling=no frameborder=0 style=border:none; overflow:hidden; width:120px; height:21px; allowTransparency=true></iframe> But if i'm
In pyroCMS it echo's its navigation like: <li class=last current> <a href=http://develop.jzm.co.nz/pyrocms/portfolio>portfolio</a> </li> What
echo ($timestamp) gives 2012-05-03 15:35:46 What would a PHP command look like that does:
echo timezone_name_from_abbr(, 3600*7, 0); //ok echo timezone_name_from_abbr(, 3600*8, 0); //NOT ok! return nothing! echo
<html> <head> <style type=text/css> body { background-color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 20px;
This is my code: <?php $baseurl = '<base_url>'; ?> <font class=font_style><?php echo $baseurl;?></font> When
I have this link created in PHP: echo '<p style=font-family: arial;>Solution name: <a class=expand_suggested_solution
I have a table: <table width=200px> <tr> <td> <font style=font-size:14px;><?php echo $text; ?></font> </td>
How would I make the font inside a php tag blue. <?php $colors =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.