How to add H1 html tag to a php code error

8 replies
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.
#add #code #error #html #php #tag
  • Profile picture of the author KirkMcD
    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.
    {{ DiscussionBoard.errors[9961906].message }}
    • Profile picture of the author ferenan
      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.
      {{ DiscussionBoard.errors[9961983].message }}
      • Profile picture of the author Zenoth
        Use <h1> tags when you display the message.
        Of course, escape the result before and do any additional checks ...

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

        echo '<h1>' . $GLOBALS["msg"] . '</h1>';
        {{ DiscussionBoard.errors[9962527].message }}
  • Profile picture of the author KirkMcD
    Somewhere in the entire script, the value is sent to the browser.
    Find that code.
    {{ DiscussionBoard.errors[9962609].message }}
  • Profile picture of the author asoka
    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>';
    {{ DiscussionBoard.errors[9962635].message }}
  • Profile picture of the author ferenan
    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.
    {{ DiscussionBoard.errors[9964170].message }}
  • Profile picture of the author Curtnielson
    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>
    {{ DiscussionBoard.errors[9983136].message }}
  • Profile picture of the author bsuperc
    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>
    {{ DiscussionBoard.errors[9995341].message }}

Trending Topics