How to add H1 html tag to a php code error

by 8 replies
11
Hi ,
I am not a coder but trying to show the below text as H1 tag but do not know how to get it done...any one can help ?

$GLOBALS["msg"]="Your page has updated";

the above text "your page has updated".
where to start and close the tag?
Thans for any feeback.
#programming #add #code #error #html #php #tag
  • Since this seems to be a custom script, you need to see how it gets displayed in order to figure out how to modify it to display the way you want.
    • [1] reply
    • Thanks for the comment MCD,
      It gets display as a normal small text and I just want to show it bigger or bold with H1.
      I hope I understood what you mean .
      I cant see any related html tag in the file itself and no clue from where its calling.
      I tried to show it like:

      $GLOBALS["msg"]="<h1>Your page has updated</h1>";

      but no success with it.
      • [1] reply
  • Somewhere in the entire script, the value is sent to the browser.
    Find that code.
    • [ 1 ] Thanks
  • Zenoth is right.. $ variables are PHP variables, so you can use following to add any HTML code
    Use following code as he suggested:
    $GLOBALS["msg"]="Your page has updated";
    then write anywhere on the php page to write in html heading.
    echo '<h1>' . $GLOBALS["msg"] . '</h1>';
    • [ 2 ] Thanks
  • Thanks for all ...I could be able to solve the issue.
    when user save data element from a website and save it to database ,how can I show the saved the data in the field ?
    in the example below I want to show the save title in the field box:
    <input name="article_title2" type="text" class="login_input" id="title2" style="width:250px;" value="<?php echo $article_title[1];?>" />

    Thanks for any help.
  • There are two main methods. I'll demonstrate both.

    1: The first method is putting the php between html. This is demonstrated below.
    <html>
    <head>
    <title>h1 tags</title>
    </head>
    <body>
    <h1><?php echo $hackname = $result['hackname']; ?></h1>
    <p>My little description goes here</p>
    </body>
    </html>

    2: The second method is to put the html in the php like so...
    <html>
    <head>
    <title>h1 tags</title>
    </head>
    <body>
    <?php echo '<h1>' . $hackname = $result['hackname'] . '</h1>'; ?>
    <p>My little description goes here</p>
    </body>
    </html>

    By the way, you can't scrap the whole '$hackname = ' part and just echo $result['hackname']. Defining a variable in an echo statement will work, but doesn't make much sense, especially in your case. Here's the above method without the '$hackname = '.

    <html>
    <head>
    <title>h1 tags</title>
    </head>
    <body>
    <?php echo '<h1>' . $result['hackname'] . '</h1>'; ?>
    <p>My little description goes here</p>
    </body>
    </html>
  • Honestly the cleanest approach is going to be this (assumes PHP shortcode is enabled, which most web hosts have):
    <html>
    < head>
    < title>h1 tags</title>
    < /head>
    < body>
    <h1><?=$result['hackname'];?></h1>
    < p>My little description goes here</p>
    < /body>
    < /html>

Next Topics on Trending Feed