electripunk Posted March 24, 2009 Share Posted March 24, 2009 I am creating a generator. This consists of 4 pages and 4 codes. I have a generator.php code.php generator-code.php preview.php here is what we are looking at: (((((top of page code))))) <? include('../../../config.php'); if ($_POST['gen']) { include ($sm['path_base'] . 'my_dir/code.php'); include ($sm['path_inc'] . 'header.php'); ?> (((((bottom of page code))))) <? { elseif ($_POST['view']) <-------------------This is line 173 (where the error is) { include($sm['path_base'] . 'my_dir/preview.php'); } ?> Here is the problem. I have tried several different things, but nothing seem to work. If I remove the include function from the top 'gen' function, it works but with an undefined function 'gen' line 12 With 'gen' defined as you see, I get a parse error, and a white page. The parse error is: Parse error: syntax error, unexpected T_ELSEIF mydirectory/generator-code.php What am I doing wrong? Link to comment https://forums.phpfreaks.com/topic/150798-solved-parse-error-syntax-error-unexpected-t_elseif-what-do-i-do/ Share on other sites More sharing options...
kenrbnsn Posted March 24, 2009 Share Posted March 24, 2009 The bracket "{" before the "elseif" probably should be "}". Ken Link to comment https://forums.phpfreaks.com/topic/150798-solved-parse-error-syntax-error-unexpected-t_elseif-what-do-i-do/#findComment-792245 Share on other sites More sharing options...
electripunk Posted March 24, 2009 Author Share Posted March 24, 2009 The bracket "{" before the "elseif" probably should be "}". Ken ok, so i changed "{" to "}" and I get a different error all together. Parse error: syntax error, unexpected '}' in mydir/generator-code.php Link to comment https://forums.phpfreaks.com/topic/150798-solved-parse-error-syntax-error-unexpected-t_elseif-what-do-i-do/#findComment-792250 Share on other sites More sharing options...
trq Posted March 24, 2009 Share Posted March 24, 2009 We need to see actual code. (In tags please) Link to comment https://forums.phpfreaks.com/topic/150798-solved-parse-error-syntax-error-unexpected-t_elseif-what-do-i-do/#findComment-792252 Share on other sites More sharing options...
electripunk Posted March 24, 2009 Author Share Posted March 24, 2009 We need to see actual code. (In tags please) This is all the code in question. I have gotten the code to work, but still shows an error. The error is undefined index 'gen' in mydir/generator-code.php [nobbc] <? include('../../../config.php'); if ($_POST['gen']) { include ($sm['path_inc'] . 'header.php'); ?> <div id="content"> <br /> <center> <h1> <? $sm['page_name'] = $sm['page_title']; echo $sm['page_name']; ?> </h1> <br /> <h2 align="center">MySpace Layout Generator</h2> </center> <br /> <br /> <center> <h3> Copy the following code into the, 'About me' section of your profile! </h3> <br /> <center><textarea name="textarea" cols=50 rows=10 class="bginput" onClick="this.focus();this.select()"> <?php echo '<style type="text/css"> body {background-color:'.$_POST['bgcolor'].'; background-image:url('.$_POST['bgimage'].'); background-position:'.$_POST['bgposition'].'; background-attachment:'.$_POST['bgmovement'].'; background-repeat:'.$_POST['bgtiled'].';} Table, Td { background-color:transparent; border-style:none; } table table td { width:100%; } table table table table td { width:auto; } table table table {background-color:'.$_POST['tablebg'].'; background-image:url('.$_POST['tableimage'].'); background-position:Top Center; background-repeat:no-repeat; border-color:'.$_POST['tablebordercolor'].'; border-style:'.$_POST['tableborderstyle'].'; border-width:'.$_POST['tableborder'].'; padding:4px;} table table table table{ background-image:none; background-color:transparent; border-style:none; } .orangetext15, .lightbluetext8, .whitetext12, .nametext, .btext, .redtext, .redbtext {color:'.$_POST['headingcolor'].'; font-size:'.$_POST['headingsize'].'; '; if ($_POST['headingstyle'] == "bold") { echo "font-weight:bold; "; } if ($_POST['headingstyle'] == "underline") { echo "text-decoration:underline; "; } if ($_POST['headingstyle'] == "strike") { echo "text-decoration:line-through; "; } echo 'font-style:normal; font-family:'.$_POST['headingfont'].',arial,verdana,sans-serif;} body, div, p, strong, td, .text, .blacktext10, .blacktext12, a.searchlinkSmall, a.searchlinkSmall:link, a.searchlinkSmall:visited { color:'.$_POST['textcolor'].'; font-size:'.$_POST['textsize'].'; '; if ($_POST['textstyle'] == "bold") { echo "font-weight:bold; "; } if ($_POST['textstyle'] == "underline") { echo "text-decoration:underline; "; } if ($_POST['textstyle'] == "strike") { echo "text-decoration:line-through; "; } echo 'font-style:normal; font-family:'.$_POST['textfont'].',arial,verdana,sans-serif;} a, a:link, a:visited, a.navbar, a.navbar:link, a.navbar:visited, a.man, a.man:link, a.man:visited {color:'.$_POST['linkcolor'].'; font-size:'.$_POST['linksize'].'; '; if ($_POST['linkstyle'] == "bold") { echo "font-weight:bold; "; } if ($_POST['linkstyle'] == "underline") { echo "text-decoration:underline; "; } if ($_POST['linkstyle'] == "strike") { echo "text-decoration:line-through; "; } echo 'font-style:normal; font-family:'.$_POST['linkfont'].',arial,verdana,sans-serif;} a:hover, a:active, a.navbar:hover, a.navbar:active, a.man:hover, a.man:active, a.searchlinkSmall:hover, a.searchlinkSmall:active {color:'.$_POST['linkhcolor'].'; font-size:'.$_POST['linkhsize'].'; '; if ($_POST['linkhstyle'] == "bold") { echo "font-weight:bold; "; } if ($_POST['linkhstyle'] == "underline") { echo "text-decoration:underline; "; } if ($_POST['linkhstyle'] == "strike") { echo "text-decoration:line-through; "; } echo 'font-style:normal; font-family:'.$_POST['linkfont'].',arial,verdana,sans-serif;} </style><br><br>This profile was edited with <a href="{url_base}" target="_blank">Rapid Codes Editor</a><br><br><a href="{url_base}" target="_blank"><img src="{dir_support_images}support.png" alt="Myspace Layouts" style="position:fixed; left:0px; top: 0px;" border="0"></a></div>'; ?></textarea></center> </center> <br /> <? include ($sm['path_inc'] . "footer.php"); ?> </div> <? } elseif ($_POST['view']) { include($sm['path_base'] . 'myspace-images/profile/generators/preview.php'); } ?> [/nobcc] Link to comment https://forums.phpfreaks.com/topic/150798-solved-parse-error-syntax-error-unexpected-t_elseif-what-do-i-do/#findComment-792286 Share on other sites More sharing options...
lonewolf217 Posted March 24, 2009 Share Posted March 24, 2009 change it to if (isset($_POST['gen']) && $_POST['gen']) Link to comment https://forums.phpfreaks.com/topic/150798-solved-parse-error-syntax-error-unexpected-t_elseif-what-do-i-do/#findComment-792293 Share on other sites More sharing options...
electripunk Posted March 24, 2009 Author Share Posted March 24, 2009 Thank you so much!!! if (isset($_POST['gen']) && $_POST['gen']) That did it. I am new to php so I am a little lost still, but I am catching on i believe. Link to comment https://forums.phpfreaks.com/topic/150798-solved-parse-error-syntax-error-unexpected-t_elseif-what-do-i-do/#findComment-792332 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.