How To Add Tag Into Php Code - SitePoint Trang chủ » H1 Con Php » How To Add Tag Into Php Code - SitePoint Có thể bạn quan tâm H1 Css Là Gì H1d H1 đài Pt-th Hà Nội H1 đan Mạch H1dfc-b1 How to add <h1> tag into php code PHP sedna March 17, 2007, 4:07pm 1 hey all, i am having problems trying to add the <h1> tag to my php code here is the code with out echo $hackname = $result['hackname'] ; basicly what that dose is pull that hacks name from the data base and shows it at the top of the page now when i add my <h1> tags to make that hack look like a title echo "<h1>" $hackname = $result['hackname'] "</h1>"; i get an error is it becuase php dose not allow html tags?, and how would i add that h1 tag to that statement? Wardrop March 17, 2007, 4:17pm 2 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> kyberfabrikken March 17, 2007, 4:20pm 3 This makes little sense: sedna: echo $hackname = $result['hackname'] ; You’ll either do: $hackname = $result['hackname']; echo $hackname; Or: echo $result['hackname']; This is syntactically illegal, which is why you’re getting an error: sedna: echo "<h1>" $hackname = $result['hackname'] "</h1>"; You can do this: $hackname = "<h1>" . $result['hackname'] . "</h1>"; echo $hackname; Or echo "<h1>" . $result['hackname'] . "</h1>"; Related topics Topic Replies Views Activity How can I add <h1> to this echo table_header ( $lang['Module_Featured_Listings'] ); PHP 17 2374 January 31, 2014 Proper Script for h1 tag CMS & WordPress php 7 764 June 17, 2023 Help with adding H1 to Title PHP 5 995 August 21, 2017 Html tags in echo string? I wish to concatenate string, then have tags after each concatenated string. Can I? PHP 8 4248 March 27, 2017 How do I add h2 to this code? HTML & CSS 8 2274 June 23, 2016 Từ khóa » H1 Con Php PHP - Use H1 Tags As Page Title - Stack Overflow HTML H1 To H6 Tag - W3Schools PHP Syntax - W3Schools Comments - Manual - PHP PHP Tags - Manual How To Add H1 Html Tag To A Php Code Error - Warrior Forum PHP Echo Statement - W3resource Views - Laravel - The PHP Framework For Web Artisans Using PHP And HTML On The Same Page - ThoughtCo Create A Login Form Validation Using PHP And WAMP / XAMPP p · GitHub Undefined Variable: Con In C:\xampp\htdocs\p On Line 6 ... Các Thẻ Heading - Của HTML