yortzec Posted March 21, 2010 Share Posted March 21, 2010 I have the following code-- but I can't figure out why it isn't working. $theloginformcontents = file_get_contents('loginform.html'); eval("\$theloginformeval = \"$theloginformcontents\";"); loginform.html is in the same directory as the php file running this code. The error message is as follows: Parse error: syntax error, unexpected T_STRING in /home/yortzec/public_html/loginform/index.php(305) : eval()'d code on line 1 It also tells me that $theloginformeval does not get defined. Notice: Undefined variable: theloginformeval in /home/yortzec/public_html/loginform/index.php on line 306 Here is my PHP Info page: http://heliohost.org/phpinfo.php Thanks so much for all the help! Link to comment https://forums.phpfreaks.com/topic/196052-t_string-parse-error-in-eval-statement/ Share on other sites More sharing options...
teamatomic Posted March 21, 2010 Share Posted March 21, 2010 Show loginform.html HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/196052-t_string-parse-error-in-eval-statement/#findComment-1029787 Share on other sites More sharing options...
yortzec Posted March 24, 2010 Author Share Posted March 24, 2010 Here's how I will be setting $rf to give you an idea: $rf = array(); $rf[] = array('tb' => 'Username: ', 'nm' => 'usernamereg', 'vf' => '', 'tp' => 'text', 'id' => ''); $rf[] = array('tb' => 'Password: ', 'nm' => 'passwordreg', 'vf' => '', 'tp' => 'password', 'id' => ''); $rf[] = array('tb' => 'Verify Password: ', 'nm' => 'verifypasswordreg', 'vf' => '', 'tp' => 'password', 'id' => ''); $rf[] = array('tb' => 'First Name: ', 'nm' => 'firstnamereg', 'vf' => '', 'tp' => 'text', 'id' => ''); $rf[] = array('tb' => 'Last Name: ', 'nm' => 'lastnamereg', 'vf' => '', 'tp' => 'text', 'id' => ''); So, $rf[0]['tb'] will return 'Username: ' And yes, there are arrays of arrays. But, I know this works, because I have gotten info from it other times in my script. Here's $hf : $hf[] = array('nm' => 'importancereg', 'vf' => '5'); <form name="input" action="" method="post"> <table style="text-align: left; width: 350px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <?php foreach($rf as $eachkey => $eachinput) { ?> <tr> <td style="vertical-align: top; text-align: right;"><?php echo $eachinput['tb']; ?> <br> </td> <td style="vertical-align: top;"><input name="<?php echo $eachinput['nm']; ?>" value="<?php echo $eachinput['vf']; ?>" type="<?php echo $eachinput['tp']; ?>" id="<?php echo $eachinput['id']; ?>"><br> </td> </tr> <tr> <td colspan="2" rowspan="1" style="vertical-align: top;"><small><small><small><small><small> </small></small></small></small></small><br> </td> </tr> <?php $arrNames[$eachkey] = $eachinput['nm']; } foreach($hf as $eachkey => $eachinput) { ?> <input name="<?php echo $eachinput['nm']; ?>" value="<?php echo $eachinput['vf']; ?>" type="hidden"> <?php } ?> <tr align="center"> <td colspan="2" rowspan="1" style="vertical-align: top;"> <small><small><small><br> </small></small></small><input value="Register" type="submit"><br> <br> <div align="center"><a href="<?php echo $thisfile; ?>">Back to Login Page</a></div> </td> </tr> </tbody> </table> </form> Link to comment https://forums.phpfreaks.com/topic/196052-t_string-parse-error-in-eval-statement/#findComment-1031330 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.