Joost Posted April 17, 2006 Share Posted April 17, 2006 When i add str_replace it will stop working and i get this error: Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content/R/u/n/Runetower/html/result.php on line 34[code]<?php $title = $_POST["title"]; $metades= $_POST["metades"]; $metakey= $_POST["metakey"]; $maincontent= $_POST["maincontent"]; $head= $_POST["head"]; $guidecat= $_POST["guidecat"]; $guidecatb= $_POST["guidecatb"]; $guidename= $_POST["guidename"]; $creditswriter= $_POST["creditswriter"]; $creditspictures= $_POST["creditspictures"]; $creditseditor= $_POST["creditseditor"]; $creditscoder= $_POST["creditscoder"]; $creditsothername= $_POST["creditsothername"]; $creditsother= $_POST["creditsother"]; $start= $_POST["start"]; $requireditems= $_POST["requireditems"]; $requiredquests= $_POST["requiredquests"]; $requiredskills= $_POST["requiredskills"]; $requiredmonsters= $_POST["requiredmonsters"]; $requiredothername= $_POST["requiredothername"]; $requiredother= $_POST["requiredother"]; $find[] = '\"'; $replace[] = '''; $title = str_replace($find, $replace, $title);?>$title="<?php echo $title; ?>"; //the title of the page (use the guide name)$metades="<?php echo $metades; ?>"; //a description$metakey="<?php echo $metakey; ?>"; //some keywords related tothe guide (seperate by ,)$maincontent="<?php echo $maincontent; ?>"; //*the main page content or the main part of the guide (make sure it has no " in it replace it with '*//$head="<?php echo $head; ?>"; //Something on the top of the page that needs to be added?//only for guides$guidecat="<?php echo $guidecat; ?>"; //* 0=not a guide 1=needs requirements 2=no requirements *//$guidecatb="<?php echo $guidecatb; ?>"; //* 0=not a guide 1=quest guide 2=skill guide 3=city guide 4=other guide *//$guidename="<?php echo $guidename; ?>"; //name of the guide$creditswriter="<?php echo $creditswriter; ?>"; //who wrote the guide?$creditspictures="<?php echo $creditspictures; ?>"; //who made the pictures?$creditseditor="<?php echo $creditseditor; ?>"; //who edited the guide?$creditscoder="<?php echo $creditscoder; ?>"; //who coded the guide?//If their need to be credits for something else add here$creditsothername="<?php echo $creditsothername; ?>"; //What sort of thing is required else?$creditsother="<?php echo $creditsother; ?>"; //Here the content...//only for quest guides$start="<?php echo $start; ?>"; //where to start?$requireditems="<?php echo $requireditems; ?>"; //items you need to have$requiredquests="<?php echo $requiredquests; ?>"; //quests you need to have done$requiredskills="<?php echo $requiredskills; ?>"; //skill level requirements$requiredmonsters="<?php echo $requiredmonsters; ?>"; //monsters that you need to kill during the quest//If their is something else required add here (if none don't pute something their)$requiredothername="<?php echo $requiredothername; ?>"; //What sort of thing is required else?$requiredother="<?php echo $requiredother; ?>"; //Here the content...<textarea cols=70 rows=6></textarea> [/code] Link to comment https://forums.phpfreaks.com/topic/7586-solved-str_replace-problem/ Share on other sites More sharing options...
wildteen88 Posted April 17, 2006 Share Posted April 17, 2006 change[code]$replace[] = ''';[/code]to[code]$replace[] = '\'';[/code]It was because you was not escaping your single quote and so PHP though you finished when you had typed the secound ' and when it came to the third ' it cuased the error. The middel ' needed to be escaped (\'). Link to comment https://forums.phpfreaks.com/topic/7586-solved-str_replace-problem/#findComment-27638 Share on other sites More sharing options...
Joost Posted April 17, 2006 Author Share Posted April 17, 2006 Thx this works great ;) Link to comment https://forums.phpfreaks.com/topic/7586-solved-str_replace-problem/#findComment-27642 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.