Jump to content

Recommended Posts

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

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.