Welcome Guest, Not a member yet? Register   Sign In
Display Problem
#1

[eluser]jvk22[/eluser]
I am making a code generator and when I try to display php tags ex. <?php ?> that are saved in a variable, nothing displays.

Here's the code
Code:
foreach ($fields as $field)
{
    $database_fields[] = $field;
    echo $field;
    $add_form_values = '<?php echo form_input($'.$field.'_attr); ?>';
}
echo $add_form_values;
#2

[eluser]skiter[/eluser]
Code:
foreach ($fields as $field)
{
    $database_fields[] = $field;
    echo $field;
    $add_form_values = form_input($field); //or $this->form_input($field)
}
echo $add_form_values;
#3

[eluser]jvk22[/eluser]
No that's not the issue. I'm making a code generator and I need to be able to store <?php ?> tags into a variable so I can save them to a file, however every time I try to put the php tags in a variable, and echo is out, nothing displays.

What should echo out is
<?php echo form_input($FIELD_NAME_attr); ?>

So I can then take that code and save it to a php file.
#4

[eluser]toopay[/eluser]
[quote author="jvk22" date="1304113840"]...however every time I try to put the php tags in a variable, and echo is out, nothing displays.[/quote]
Did you try to see the source? CTRL+U. If php tag correctly rendered, then you'll see them.
[quote author="jvk22" date="1304113840"]
What should echo out is
<?php echo form_input($FIELD_NAME_attr); ?>[/quote]
To display it on a browser, try this...
Code:
$var = htmlspecialchars('<?php echo $var ?>');
echo $var;
to decode it, when you want to save it into a file, use
Code:
htmlspecialchars_decode($var);
#5

[eluser]jvk22[/eluser]
That worked, thanks.




Theme © iAndrew 2016 - Forum software by © MyBB