Welcome Guest, Not a member yet? Register   Sign In
Textarea with a variable in it
#1

[eluser]Fr3aked0ut[/eluser]
Hi, I am building a new system which works with CodeIgniter (Mhmm...) of course.
So, I tried to make some textarea with a variable in it, e.g:
Code:
<textarea name='meta' id="meta" cols="55" rows="10">
<?=$meta?>
</textarea>
Now my whole site is in the textarea.(All of the site's source code is in the textarea and does not display in the web itself).

What should I do?


Thanks in advance.
#2

[eluser]pistolPete[/eluser]
[quote author="Fr3aked0ut" date="1235487052"]What should I do? [/quote]
Post more code (controller and view)!
#3

[eluser]Fr3aked0ut[/eluser]
Actually, what I posted is part of my view file.
Here is what you need (I cant give whole view file it's long and you dont need it)
Code:
<form action="" method="post">
<strong>Tags</strong><br />
&lt;textarea name='meta' id="meta" cols="55" rows="10"&gt;
&lt;?=$meta?&gt;
&lt;/textarea&gt;&lt;br />
<strong>Web closed?</strong><br />
&lt;input type="radio" name="closed" value="1" /&gt;Yes
&lt;input type="radio" name="closed" value="0" /&gt;Nah..
<br />
&lt;input type="submit" name="submit" value="Send" /&gt;
&lt;/form&gt;

Controller(current page's function):
Code:
function system()
    {
        global $url;
        $sys = array();
        $sys['site'] = $url['site'];
        $this->load->database();
        if( isset($_POST['submit']) )
        {
        $query = $this->db->query('SELECT * FROM dev_system');
        $row = $query->row();
        $sys['meta'] = $row->meta;
        $sys['message'] = '';
        }
        else
        {
            if( empty($_POST['meta']) OR $_POST['closed'] == "" )
            {
                $sys['message'] = 'אנא מלא את כל הפרטים';
            }
            else
            {
                $closed = $this->input->post('closed');
                $meta = $this->input->post('meta');
                $query = $this->db->query("INSERT INTO dev_system (closed,meta) VALUES ('{$closed}','{$meta}')");
                $sys['message'] = 'הגדרות עודכנו בהצלחה.';
            }
        }
        return $this->load->admin_view('system', $sys, true);
    }
#4

[eluser]pistolPete[/eluser]
First of all, don't use short open tags.

Code:
return $this->load->admin_view('system', $sys, true);

Where are you returning these contents to?
Did you extend the loader class? Because by default there is no 'admin_view'.
#5

[eluser]Fr3aked0ut[/eluser]
Of course, I made the function admin_view in Loader.php.
And im returning it to:
Code:
$output .= $this->$page();
#6

[eluser]TheFuzzy0ne[/eluser]
Please post the contents of that function also.

It's possible that your problem is being caused by invalid HTML. [url="validator.w3.org"]It is well worth validating your code[/url], to be sure. I've seen simple typos mess up my entire Web site.
#7

[eluser]Fr3aked0ut[/eluser]
The function is working, 100% because im using it for all of my admin control panel.
Code:
function admin_view($view, $vars = array(), $return = FALSE)
    {
        $query = mysql_query('SELECT * FROM dev_system');
        $row = mysql_fetch_assoc($query);
        $this->_ci_view_path = APPPATH.'admin_view/'. $row['admin_skin']. '/';
        return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
    }

I dont think W3C could check it, because to see it they have to login first (Admin control panel..)
#8

[eluser]pistolPete[/eluser]
[quote author="Fr3aked0ut" date="1235499178"]I dont think W3C could check it, because to see it they have to login first (Admin control panel..)[/quote]

Then use "Validate by direct Input" or "Validate by File upload".
#9

[eluser]Colin Williams[/eluser]
Just run htmlspecialchars($meta) and see if that does the trick.
#10

[eluser]TheFuzzy0ne[/eluser]
Blast! I just came on here to suggest doing that. Hehe.




Theme © iAndrew 2016 - Forum software by © MyBB