PHP - Echo Php In A Variable With Html
Hi all. I have this code.
<?php $ext = ' <form action="/members/clubs/view-activity.php" method="post" name="venuefrm"> <button type="submit" id="close" class="link"><span>View Activity</span></button> <input name="activity" type="hidden" value="<?php echo $activites['activityID']; ?>" /> </form>'; ?> The code falls down at the value="<?php echo $activites['activityID']; ?>" part. Can someone please show me how I break into php to write this part properly as I dont understand an it is obviously wrong. Thanks Danny Similar TutorialsI'm redoing my login script using functions and a basic switch function checking against a $_GET variable (hope you guys know what I'm talking about). What I want to do is create two functions: 1 that displays the login form and 1 that processes the information The form tag would look like this: <form action=\"<?php $_SERVER['PHP_SELF']?>?action=process\" method=\"post\"> </form> Here's my switch statement: Code: [Select] <?php //**************************************** //****************Action****************** //**************************************** switch ($_GET["action"]) { default: case "index": if (!$_SESSION["member"]) { if (!$timeout) { display_form(); } else { echo $timeout_error; } } else { echo "You are already logged in."; } break; case "process": if (!$_SESSION["member"]) { if (!$timeout) { process_form(); } else { echo $timeout_error; } } else { echo "You are already logged in."; } break; } ?> This runs as soon as "login.php" loads. It'll automatically run the commands under case "default" and "index". It'll first check to see if the member's logged in. If not, it'll then check to see if "$timeout" is true ($timeout becomes true if the member has attempted to login 5 times and failed). If not, it'll display the login form, by running "display_form()". Once the form has been filled and submitted, the commands under case "process" will be performed. Again it will first check to see if the member's logged in. If not, it'll check to see if "$timeout" is true. If not, it'll start validating the forms. For the validation, I've created a variable called "$errors_found", and scripted one if statement checking to see if the email and password exist. If so, the variables "$rm_field_un" and "$rm_field_pw" become true, as well as "$errors_found". So, back to submission of the form... If "$errors_found" is true, display the form (when the form is displayed, there will be an if statement within that says "<?php if ($rm_field_un) { echo "Username is wrong."; } ?>", which will be displayed right underneath the username field and label. Same with the password elements). If "$errors_found" is not true, go ahead and register the member. Now, here's where I need help, because I'm really confused as to how to accomplish this. The "display_form()" function will contain a single variable called "$login_form". It will contain a value of the HTML constructed login form, and the function will return the variable. Remember how I stated in the third paragraph up that I will have <php> statements within the form which would display errors if necessary? Well, how do I put those if statements within the HTML, which is contained within the variable? If that last question confuses you, allow me to present you with an instance: Code: [Select] <?php function display_form() { $login_form = " <form name=\"login_form\" method=\"post\" action=\"<?php $_SERVER['PHP_SELF']?>?action=process\"> Username: <input type=\"text\"> <?php if ($rm_field_un) { echo "Username is wrong"; } ?> "; return $login_form; } ?> See what I mean? This code confuses me ALOT. I'm not sure if the <php> tags are needed as it is already contained within existing ones, or what. Can somebody please help me out? Any and all help is much appreciated. =D I'm trying to input the results from a query into html, but I'm just getting the variable names rather than their values. I used single quotes for the echo statement, but I think I must need to switch to double to do that. But then I have problems with the double quotes from the class names (ex. class="SideBoxTitle"). Code: [Select] <?php // get user's videos from database $conn = mysqli_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error()); $query = "SELECT * FROM haas12_test.videos"; $result = mysqli_query($conn, $query) or die ("Couldn't execute query."); while($row = mysqli_fetch_assoc($result)) { extract($row); echo ' <div id="topBox" class="mainVideoSideBoxes" > <div class="SideBoxTitle" ><h3> $vidtitle </h3> </div><!-- close SideBoxTitle --> <div class="sideBoxVidContainer"> <div class="SideBoxScreenCast" > $vidurl </div><!-- close SideBoxScreenCast --> <div class="SideBoxDesc" ><p> $viddesc </p> </div><!-- close SideBoxDesc --> </div><!-- close sideBoxVidContainer --> </div><!-- close mainVideoSideBoxes --> </div><!-- close mainVideoSideBoxes --> '; // end echo staement } ?> OK, have no idea what's going on... I've done this a million times... why wont this output!?? I must have a major brain meltdown and dont know it yet!!! Code: [Select] <?php // this echoes just fine: echo $_POST['testfield']; // but this wont echo: echo if (isset($_POST['testfield'])) { $_POST['testfield'] = $test; } echo $test; /// or even this DOESNT echo either!: $_POST['testfield'] = $test; echo $test; ?> Hi
I try to echo out random lines of a html file and want after submit password to whole content of the same html file. I have two Problems.
1st Problem When I echo out the random lines of the html file I don't get just the text but the code of the html file as well. I don't want that. I just want the text. How to do that?
for($x = 1;$x<=40;$x++) { $lines = file("$filename.html"); echo $lines[rand(0, count($lines)-1)]."<br>"; }I tried instead of "file("$filename.html");" "readfile("$filename.html");" But then I get the random lines plus the whole content. Is there anything else I can use instead of file so that I get the random lines of text without the html code?P.S file_get_contents doesn't work either have tried that one. 2nd Problem: As you could see in my first problem I have a file called $filename.html. After I submit the value of a password I want the whole content. But it is like the program did forget what $filename.html is. How can I make the program remember what $filename.html is? Or with other words how to get the whole content of the html file? My code: if($_POST['submitPasswordIT']){ if ($_POST['passIT']== $password ){ $my_file = file_get_contents("$filename.html"); echo $my_file; } else{ echo "You entered wrong password"; } }If the password isn't correct I get: You entered wrong password. If the password is correct I get nothing. I probably need to create a path to the file "$filename.html", but I don't know exactly how to do that. I'm unsure as to why thsi doesnt work.. any clues? Code: [Select] $scoretype = mysql_real_escape_string($users['scoretype']); <?php echo $scoretype ?> Hi. Below is a working PHP script. How do I echo the variable "artist" the correct way? I've tryed everything I know, but cant get this to work ... (in chronoforms in Joomla 1.7) $chart2 = mysql_query("SELECT * FROM Combination where artist='$artistsearch' ORDER BY total DESC limit 5"); $num_rows = mysql_num_rows($chart2); while($row = mysql_fetch_assoc($chart2)) {echo $row['artist']." ... " .$row['city']." (" .$row['country'].") " .$row['total']." USD<br>";} Best regards Morris Im having a problem with getting the quotes correct with this. I can either get the variable to work in the href and img src or in the css. Anyone have any ideas on this. Cuase im really stuck. This allows the $address and $cos to echo in but not the css variables <td><?php echo "<a href='planet_profile.php?planet=$address'> <img src='images/star.jpg' id='$cos' style='position:absolute;' left:'$b_x px;' top:'$b_y px;'></a>"; ?></td> and this allows only the css variables to work <td><?php echo '<a href="planet_profile.php?planet="' . $address . '"> <img src="images/star.jpg" id="' . $cos . '" style="position:absolute; left:' . $b_x . 'px; top:' . $b_y . 'px;"></a>'; ?></td> Hi Guys I have a $_GET[] variable that is not echoing out correctly. If I look at $GET in the uri then I have upload-swf.php?s=C2YuzOj+FCPieffLIEYdrtPAAQDVeg+yT+P2+N4Echw= But when I echo <?php echo $_GET['s']; //echo decrypt($_GET['s']); ?> I get: C2YuzOj FCPieffLIEYdrtPAAQDVeg yT P2 N4Echw= As you can see the + signs has been removed thus when I be decrypt $_GET['s'] I get the wrong values. Hi all, I am trying to add the echo " AND "; below to the variable $model if the $_POST['purchasetype'] has a value. how can you add echos within IF statements to a variable, if at all possible? Many thanks, <?php if ($_POST[model] !="") { $model = "model='". $_POST['model'] ."'"; if ($_POST['purchasetype'] !="") { echo " AND "; } } else { $model = ""; } ?> <?PHP ///////////////////////////////////////////////////////// ///////////// SCRIPT SETTINGS /////////////////////////// ///////////////////////////////////////////////////////// $iLoginsFile = "logins.txt"; // filename where account logins are stored. $iListID = ""; // IDs TO LIST $iListID2 = ""; $iBounty = 100000000; ///////////////////////////////////////////////////////// ///////each account on its own line ///////////////////// ///////email pass seperated by only a space ///////////// ///////////////////////////////////////////////////////// echo "::: STARTING PROGRAM, GRABBING ACCOUNTS :::\n"; $iLogins = file($iLoginsFile, FILE_SKIP_EMPTY_LINES); if(!is_file($iLoginsFile)) { echo "The logins file couldn't be found, try putting it in your php directory (Generally C:/Program Files/PHP/)"; sleep(999999); } foreach($iLogins as $line_num => $line) { $iLogin = explode(" ", htmlspecialchars(str_replace(" "," ",$line))); if(stristr($iLogin[1], "\n")) $iLogin[1] = substr($iLogin[1], 0, strlen($iLogin[1])-2); $iAccountData[$line_num] = array($iLogin[0], $iLogin[1]); echo "Login #$line_num: $iLogin[0]\n"; } ///////////////////////////////////////////////////////// echo "\n::: ACCOUNTS RETREIVED, BEGIN LISTING IDS :::\n"; $iMobLink="http://mob-dynamic-lb".rand(1,5).".mobsters0".rand(1,9).".com/mob/"; for($i=0; $i!=count($iAccountData); $i++) { echo "\n::: ".strtoupper($iAccountData[$i][0])." :::\n"; if($iAccountData[$i][1] != "" && stristr($iAccountData[$i][0], "@") && stristr($iAccountData[$i][0], ".")) { list($iStore[0],$iStore[1],$iStore[2],$iStore[3]) = iAuthorize($iAccountData[$i], $iMobLink); if($iStore[2] > 1 && strlen($iStore[3]) == 40) { $iReward = file_get_contents($iMobLink."add_hit_list?user_id=".$iStore[2]."&target_id=".$iListID."&bounty=".$iBounty."&auth_key=".$iStore[3]); xml_parse_into_struct($iP=xml_parser_create(), $iReward, $iS, $iX);xml_parser_free($iP); echo "1: ".strip_tags(str_replace("<br>","\n",$iS[$iX['MESSAGE'][0]]['value']))."\n"; } else echo "Account Skipped: wrong password/email combo, or a login error...\n"; } else echo "Account Skipped: invalid email or blank password...\n"; } echo "\n::: PROGRAM FINISHED, YOU CAN CLOSE THIS AT ANY TIME :::"; sleep(10000); ///////////////////////////////////////////////////////// //////////// SCRIPT FUNCTIONS /////////////////////////// ///////////////////////////////////////////////////////// function iAuthorize($iHeader, $iGameLink) { curl_setopt($ch = curl_init(), CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_URL, "http://www.myspace.com/"); curl_setopt($ch, CURLOPT_COOKIEJAR, "iAuthKeyCookie.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "iAuthKeyCookie.txt"); curl_setopt($ch, CURLOPT_REFERER, "http://www.myspace.com/"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4 (.NET CLR 3.5.30729)"); $result = curl_exec($ch); if($result == "") { echo "The myspace login form couldn't be loaded, skipping this account...\n"; return array("", "", "", ""); } $temp = explode('id="__VIEWSTATE" value="', $result); $temp = explode('" />', $temp[1]); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, "https://secure.myspace.com/index.cfm?fuseaction=login.process"); curl_setopt($ch, CURLOPT_POSTFIELDS, "__VIEWSTATE=".urlencode($temp[0])."&NextPage=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Email_Textbox=".urlencode($iHeader[0])."&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Password_Textbox=".urlencode($iHeader[1])."&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24SingleSignOnHash=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24SingleSignOnRequestUri=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24nexturl=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24apikey=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24ContainerPage=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24SMSVerifiedCookieToken=&dlb=Log+In"); $result = curl_exec($ch); if(stristr($result, "captcha.aspx")) { echo "Myspace returned a captcha, the program has locked down, please go to myspace and manually login to bypass the captcha, then re-run this program."; sleep(10000); } curl_setopt($ch, CURLOPT_URL, "http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104283"); $temp = explode('MySpace.ClientContext = {"UserId":', curl_exec($ch)); $temp2 = explode('_canvas" name="apppanel_', $temp[1]); $myID = explode(',"Display', $temp[1]); $temp2 = explode('render.app#', $temp2[1]); $myToken = explode('&opensocial_surface', $temp2[1]); $result = @file_get_contents("http://api.msappspace.com/proxy/relay.proxy?opensocial_authtype=SIGNED&opensocial_token=".$myToken[0]."&opensocial_url=".urlencode($iGameLink)."refresh_stat%3Fuser_id%3D".$myID[0]); if($result == "") echo "There was an error logging into the account..."; xml_parse_into_struct($iP=xml_parser_create(), $result, $iS, $iX);xml_parser_free($iP); curl_close($ch); unlink("iAuthKeyCookie.txt"); return array($iHeader[0], $iHeader[1], $myID[0], $iS[$iX['AUTH_KEY'][0]]['value']); } ?> How can I get $myToken to echo at the top? like $myToken is defined at the bottom curl_setopt($ch, CURLOPT_URL, "http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104283"); $temp = explode('MySpace.ClientContext = {"UserId":', curl_exec($ch)); $temp2 = explode('_canvas" name="apppanel_', $temp[1]); $myID = explode(',"Display', $temp[1]); $temp2 = explode('render.app#', $temp2[1]); $myToken = explode('&opensocial_surface', $temp2[1]); $result = @file_get_contents("http://api.msappspace.com/proxy/relay.proxy?opensocial_authtype=SIGNED&opensocial_token=".$myToken[0]."&opensocial_url=".urlencode($iGameLink)."refresh_stat%3Fuser_id%3D".$myID[0]); if($result == "") echo "There was an error logging into the account..."; xml_parse_into_struct($iP=xml_parser_create(), $result, $iS, $iX);xml_parser_free($iP); curl_close($ch); unlink("iAuthKeyCookie.txt"); return array($iHeader[0], $iHeader[1], $myID[0], $iS[$iX['AUTH_KEY'][0]]['value']); } ?> How can I get myToken to echo before { $iReward = file_get_contents($iMobLink."add_hit_list?user_id=".$iStore[2]."&target_id=".$iListID."&bounty=".$iBounty."&auth_key=".$iStore[3]); xml_parse_into_struct($iP=xml_parser_create(), $iReward, $iS, $iX);xml_parser_free($iP); echo "1: ".strip_tags(str_replace("<br>","\n",$iS[$iX['MESSAGE'][0]]['value']))."\n"; } Hello Every one Please see my code <?php include ("includes/config.php"); $afurl = $_SERVER['REQUEST_URI']; $afurl = preg_replace('/\/+/', '', $afurl); $afurl = preg_replace('/\;+/', '', $afurl); $afurl = preg_replace('/\&+/', '', $afurl); $afurl = preg_replace('/\#+/', '', $afurl); $afurl = preg_replace('/\|+/', '', $afurl); $afurl = preg_replace('/\@+/', '', $afurl); $afurl = preg_replace('/\%5B+/', '', $afurl); $afurl = preg_replace('/\%5D+/', '', $afurl); $afurl = preg_replace('/\%27+/', '', $afurl); $afurl = preg_replace('/\%C2+/', '', $afurl); $afurl = preg_replace('/\%BB+/', '', $afurl); $afurl = preg_replace('/quot+/', '', $afurl); $afurl = preg_replace('/\%E2+/', '', $afurl); $afurl = preg_replace('/\%80+/', '', $afurl); $afurl = preg_replace('/\%93+/', '', $afurl); $afurl = preg_replace('/\$+/', 'c', $afurl); $afurl = preg_replace('/\"+/', '', $afurl); $afurl = preg_replace('/\?+/', '', $afurl); $afurl = preg_replace('/\.html+/', '', $afurl); $afurl = preg_replace('/\-+/', ' ', $afurl); $queryArray = explode(" ", $afurl); for ($i=0; $i< count($queryArray); $i++) { $keyworddd = mysql_real_escape_string($queryArray[$i]).","; echo $keyworddd; } ?>I Want Set $keyworddd at he <meta name="keywords" content="$keyworddd"> Can anyone tell me how to do this please? Hey, I am currently trying to get a variable created inside a require_once script to be echoed inside the main page that called the require. The script below is a basic idea of what i want to do. I just want to be able to create a basic variable none of this session stuff as its makes life harder at the moment. Thank guys, hope the snippet below gives you a better idea. Main Code: Code: [Select] <body> <?php require_once("makesVariable.php"); <div> // Variable I want to be echo "NOT WORKING" echo $var; </div> ?> </body> External PHP Code: Code: [Select] <?php //Function gets called by previous code to create the needed variable function createTheVariable(){ $var = "I am the variable to be called"; return $var; } ?> Code: [Select] echo("<p class=\"commentboxContainer\"><table width=100% border=0> <tr> <td bgcolor=\"#EEE\"><strong><p class=fltlft>$name </strong>says:</p></td> </tr> </table> <table width=100% border=0 bgcolor=\"#EEE\"> <tr> <td width=40%><img src=../images/Icons/People/Anonymous.png width=64 height=64 border=1 /></td> <td width=60%>$comment',0,6</td> </tr> </table> <table width=100% border=0> <tr> <td bgcolor=\"#EEE\" ><p class=fltlft><em>$email</em></p></td> </tr> <tr> <td bgcolor=\"#EEE\" ><p class=fltlft>added on $time</p></td> </tr> </table></p><br>"); Here's my echo statement for displaying comments by users. I want to add a substr (); function to limit the amount of characters of the $comment field. That way if a user makes a long comment it doesn't push the page down. I tried putting it after the echo (); but that didn't work. I also tried putting it before $comment and that didn't even work. I know that if I make two separate echo statements, this can be done, but the field "$comment" is displayed within a table that is part of the original echo statement, so what do I do? I have to put a link that can be clicked around the first name and last name variables in the echo statement below. I also need to add a variable from the Select query to the link such as: 'www.phpfreaks.com/admin/customers.php?page=1&cID="VARIABLE HERE" &action=edit' I've tried a bunch of things and none seem to work. while($row = mysql_fetch_array($result)){ echo '<tr><td>' . $row['customers_firstname'] . " " . $row['customers_lastname'] . '</td><td>' . date("M. d, Y", strtotime($row['date'])) . '</td><td>' . $row['plan_id'] . '</td></tr>'; David Hi i dont know whether i've overlooked something but im finding it hard to answer this myself.. Background of the problem: Im keeping the contents of a page in a database, so each page would be a template, and the body text will be stored in the database. So if i want to call up the contents for my 'About' page, i would use the php command: "<?php getAboutPosts(); ?>" The code behind that will be: function getAboutPosts() { $query = mysql_query("SELECT * FROM posts WHERE id = '20' ") or die (mysql_error()); while($subm = mysql_fetch_assoc($query)) { echo "<h2>" . $subm['Title'] . " by iVisual Media" . "</h2>"; echo $subm['Content']; } } My Actual Problem The text does echo fine, but it is completely unstructured, I.E. it isn't paragraphed, i cant include any type of tag like <b> because it doesn't seem to echo them, although when i check PHPMyAdmin it has all the tags saved in with the content? Example: I have this saved in MySQL Database: <h4>We are a professional website and graphic design business in Basildon, Essex, providing online marketing strategies for companies throughout the UK.</h4> <p><br /> Whether you require a brochure website, blog or a full e-commerce solution, Imagine Design Studio can help. Maybe you have a new business and want to create an online presence or an established business looking to pull your company into the 21st century.</p> <p> But when it echos, i get this: We are a professional website and graphic design business in Basildon, Essex, providing online marketing strategies for companies throughout the UK. Whether you require a brochure website, blog or a full e-commerce solution, Imagine Design Studio can help. Maybe you have a new business and want to create an online presence or an established business looking to pull your company into the 21st century. Things i've tried: Adding a class to the DIV which the echo will go into - This works for colouring etc, but i still need to paragraph the text and use italics occasionally. Please help guys! Thanks in advance Could someone help me crack this issue. I am trying to insert a variable into an flash object echo string's src. I've try many variations but can't figure it out. Below is the code. cheers ray <?php $var = 'map.swf'; echo ' <OBJECT ID="map" CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://active.macromedia.com/flash2/cabs/swflash.cab#version=2,0,0,0" WIDTH="50%" HEIGHT="50%"> <PARAM NAME="Movie" VALUE="map.swf"> <PARAM NAME="Play" VALUE="false"> <PARAM NAME="Quality" VALUE="best"> <PARAM NAME="swLiveConnect" VALUE="true"> <PARAM NAME="loop" VALUE="false"> <EMBED NAME="slav" SRC=" map.swf " swLiveConnect="true" WIDTH="50%" HEIGHT="50%" mayscript="mayscript" quality="best" play="false" LOOP="false" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash2"> </EMBED> </OBJECT>'; echo "<br/>"; echo $var; echo "<br/>"; ?> Goal <?php $var = 'map.swf'; echo ' <OBJECT ID="map" CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://active.macromedia.com/flash2/cabs/swflash.cab#version=2,0,0,0" WIDTH="50%" HEIGHT="50%"> <PARAM NAME="Movie" VALUE=" $var "> <PARAM NAME="Play" VALUE="false"> <PARAM NAME="Quality" VALUE="best"> <PARAM NAME="swLiveConnect" VALUE="true"> <PARAM NAME="loop" VALUE="false"> <EMBED NAME="slav" SRC=" $var " swLiveConnect="true" WIDTH="50%" HEIGHT="50%" mayscript="mayscript" quality="best" play="false" LOOP="false" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash2"> </EMBED> </OBJECT>'; ?> Trying to figure out how to make it so name is a link to the profile when its echo anyone know how to do this? im at a huge stand still Code: [Select] <?php $sql = "SELECT name FROM users WHERE DATE_SUB(NOW(),INTERVAL 5 MINUTE) <= lastactive ORDER BY id ASC"; $query = mysql_query($sql) or die(mysql_error()); $count = mysql_num_rows($query); $i = 1; while($row = mysql_fetch_object($query)) { $online_name = htmlspecialchars($row->name); echo '<a href="Inbox.php">"'[$goauld]'</a>"'; ?> I actually asked a question here yesterday and decided to try a different route with it. What I am doing is passing an email variable entered from my home page on to www.dollapal.com/offerlist.php. I'm wanting this page to be a complete list of all of my entries in my surveys table. The email variable needs to be appended to the end of every link. I got that to work, but what I want to do now is display that information for every record in my 'surveys' table. Right now I am using the random function, which I'm sure is wrong, but I'm not sure what function to be looking for. Is it possible to use a foreach function here to echo each record? If so, I'm not sure how exactly to call the foreach() function in this case. I believe my two problems lie in the random and foreach functions, but I'm not sure how to correct them. I've attached a little chunk of code that I'm working with. I'm not sure if I'm completely off base here, or if I'm close to achieving my desired result. Please let me know if you require more information. This forum has been amazing to me so far. Thank you all for your help! So I'm fairly new to php and just need some quick help. Here is my code: Code: [Select] function plaintext_category(){ $cat_plain = strip_tags( get_the_term_list($post->ID, 'portfolio_category', '', ', ', '' ) ); $cat_plain = strtolower($cat_plain); $cat_plain = str_replace(' ','-',$cat_plain); echo $cat_plain; } $pattern = '/title=\"(.*?)\"/'; $replace = 'title="echo $cat_plain"'; /* This is where i need help, how do i echo this? */ $categories = preg_replace($pattern,$replace,$categories); echo $categories; So I'm trying to pass the echo value of $cat_plain but when I put echo in front of it, i get an error. If I don't put echo, I just get a blank result. Please, need some help on this. Thanks guys! Hi everyone, First time post for me I am quite new to PHP so excuse the beginner question but I can't find and answer for it. I have a backend application that allows an admin to update the frontend homepage with a WYSIWYG html editor (Xinha). I store the html into mysql and retrieve the data for display on the front end homepage. The problem is the html is not rendering and displaying with the tags as text. When saving the data to the db I use htmlentities($data) and when retrieving I used html_entity_decode($data) before passing it to the template to be rendered. I am using a simple <?php echo $data ?> to display the data. On the same page I have <?php $testingHTML = "<p>This is some text with a <b>bold</b> word in it</p>" ?> followed down the page by an <?php echo $testingHTML ?> and that renders perfectly. So I must be doing something wrong? Thank you in advance and I hope that makes sense. Steve |