Welcome Guest, Not a member yet? Register   Sign In
Annoying Error - unexpected T_OBJECT_OPERATOR
#1

[eluser]SpaceBiscuits[/eluser]
Hello, I am currently following a tutorial on youtube, about making a log in page. The problem is, *i think* the tutorial is based in php5 and I only have the php4 installed on my web hosting package. This may not be the problem but after hours of looking online, this is the only conclusion I can come to. The following is the page which handles the log in view.... I have also included a snippet of the validation code the controllers page.

Code:
<html>
<head>
</head>

<h1>Please Login</h1>

<p>Use the following form to login</p>

<div id="login_form">

&lt;?php echo form_open('./admin/login'); ?&gt;

<ul>

    <li>
        <lable>Username</lable>
         <div>
    &lt;?php echo form_input(array('id' -> 'username', 'name', -> 'username')): ?&gt;
            </div>

    </li>

    <li>
        <lable>Password</lable>
        <div>
        &lt;?php echo form_input(array('id' -> 'password', 'name', -> 'password')): ?&gt;
    </li>

<li>&lt;?php echo validation_errors(); ?&gt;</li>

    <li>
        &lt;?php echo form_submit(array('name' => 'submit'), 'Login'); ?&gt;
    </li>

</ul>


&lt;?php echo form_close(); ?&gt;


</div>



&lt;/body&gt;
&lt;/html&gt;

And

Code:
$this->form_validation->set_rules('username', 'Username', 'redirect|trim|max_length[50]|xxx_clean');
$this->form_validation->set_rules('password', 'Password', 'redirect|trim|max_length[200]|xxx_clean');

The error that I get is:-

Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ')' in /home/califo53/public_html/CodeIgniterBlog/system/application/views/login_view.php on line 18

I hope I am posting this in the correct place, any help would be awesome!

Thanks
#2

[eluser]wh1tel1te[/eluser]
The error that PHP gives you tells you to look at line 18 of your view file, specifically:

Code:
&lt;?php echo form_input(array('id' -> 'username', 'name', -> 'username')): ?&gt;

Have a really good look at that line, I can see the error. Hint: it's nothing to do with your PHP version, just syntax error.
#3

[eluser]SpaceBiscuits[/eluser]
I had another little look, I saw a couple of errors, and I think I have fixed them... But I still get the same error Sad

Code:
<li>
        <lable>Username</lable>
         <div>
        &lt;?php echo form_input(array('id' -> 'username', 'name' -> 'username')); ?&gt;
            </div>

    </li>

    <li>
        <lable>Password</lable>
        <div>
        &lt;?php echo form_password(array('id' -> 'password', 'name' -> 'password')); ?&gt;
    </li>
#4

[eluser]wh1tel1te[/eluser]
"->" is invalid syntax for arrays. Use "=>".

Code:
&lt;?php echo form_input(array('id' => 'username', 'name' => 'username')); ?&gt;
#5

[eluser]SpaceBiscuits[/eluser]
Thanks you VERY much for that, I have been stuck on the same error for hours, I think I am loosing my mind Tongue

Thanks you once again Smile




Theme © iAndrew 2016 - Forum software by © MyBB