How To Add Tag Into Php Code - SitePoint Trang chủ » H1 Php » How To Add Tag Into Php Code - SitePoint Có thể bạn quan tâm H-1 Pv H1q H1r H1r1y1 H1r2 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 2343 January 31, 2014 Proper Script for h1 tag CMS & WordPress php 7 756 June 17, 2023 Help with adding H1 to Title PHP 5 985 August 21, 2017 Html tags in echo string? I wish to concatenate string, then have tags after each concatenated string. Can I? PHP 8 4220 March 27, 2017 How do I add h2 to this code? HTML & CSS 8 2263 June 23, 2016 Từ khóa » H1 Php HTML H1 To H6 Tag - W3Schools Echo In With Php Possible - Html - Stack Overflow How To Add H1 Html Tag To A Php Code Error - Warrior Forum How To Style H1 Element Inside Php? - CSS-Tricks HTML: Tag - TechOnTheNet How To Echo HTML In PHP ? - GeeksforGeeks PHP Tags - Manual PHP Echo Statement - W3resource How To Use PHP In HTML - Code Tutsplus PHP Developer Wanted! We Are Looking For You! - H1 HERA Combined Results From The H1 And ZEUS Experiments Importance Of HTML Headings: H1 To H6 - Tutorial Republic Security Bank Posts Php 3.1 Billion Net Income In H1-2021