Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   How to add H1 html tag to a php code error (https://www.warriorforum.com/programming/1059269-how-add-h1-html-tag-php-code-error.html)

ferenan 25th March 2015 01:58 AM

How to add H1 html tag to a php code error
 
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.

KirkMcD 25th March 2015 03:30 AM

Re: How to add H1 html tag to a php code error
 
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.

ferenan 25th March 2015 04:31 AM

Re: How to add H1 html tag to a php code error
 
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.

Zenoth 25th March 2015 10:05 AM

Re: How to add H1 html tag to a php code error
 
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>';

KirkMcD 25th March 2015 10:44 AM

Re: How to add H1 html tag to a php code error
 
Somewhere in the entire script, the value is sent to the browser.
Find that code.

asoka 25th March 2015 10:59 AM

Re: How to add H1 html tag to a php code error
 
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>';

ferenan 26th March 2015 05:17 AM

Re: How to add H1 html tag to a php code error
 
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.

Curtnielson 4th April 2015 01:43 PM

Re: How to add H1 html tag to a php code error
 
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>

bsuperc 10th April 2015 03:48 PM

Re: How to add H1 html tag to a php code error
 
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>


All times are GMT -6. The time now is 10:56 AM.