Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8803481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:21:07+00:00 2026-06-14T01:21:07+00:00

I’m new at using this. Help me please. I am really confused. Please help

  • 0

I’m new at using this.
Help me please. I am really confused. Please help me.

This error is appearing:
I dont know what my mistake is. I saw it from a tutorial and he never even made any error

    Parse error: syntax error, unexpected '(', expecting T_STRING or 
    T_VARIABLE or '{' or '$' in 
    C:\xampp\htdocs\test\application\controllers\user.php on line 50

If you guys can help me. Here are my files:

this is my user.php

   <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    class User extends CI_Controller {
     private $view_data = array();
function _construct()
{
parent::_construct();
$this->view_data['base_url']=base_url();
}

function index()
{
$this->register();
}

function register()
{
$this->load->library('form_validation');

$this->form_validation->set_rules('firstname', 'First Name', 'trim|required|max_length[100]|min_length[1]|xss_clean');
$this->form_validation->set_rules('lastname', 'Last Name', 'trim|required|max_length[100]|min_length[1]|xss_clean');
$this->form_validation->set_rules('email', 'Email Address', 'trim|required|max_length[100]|xss_clean|valid_email');
$this->form_validation->set_rules('dateofbirth', 'Date of Birth', 'trim|max_length[100]|min_length[1]|xss_clean');
$this->form_validation->set_rules('gender', 'Gender', 'trim|max_length[6]|min_length[6]|xss_clean');
$this->form_validation->set_rules('username', 'User Name', 'trim|required|alpha_numeric|callback_username_not_exists|max_length[100]|min_length[6]|xss_clean'); 


if ($this->form_validation->run() == FALSE)
{
//not run
$this->load->view('view_register', $this->view_data);

}
else
{
//good
$firstname=$this->input->post('firstname'); 
$lastname=$this->input->post('lastname');
$email=$this->input->post->('email');
$dateofbirth=$this->input->post('dateofbirth');
$gender=$this->input->post('gender');
$username=$this->input->post('username');
$password=$this->input->post('password');

$this->User_model->register_user($firstname, $lastname, $email, $dateofbirth, $gender, $username, $password);

function username_not_exists($username){
$this->form_validation->set_message('username_not_exists','the username %s is existing');
if($this->User_model->check_exists_username($username))
{
return false;
}
else
{
return true;
}
}

}
$this->load->view('view_register', $this->view_data);
}
}

This is my view_register.php

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Registration</title>

<style type="text/css">

::selection{ background-color: #E13300; color: white; }
::moz-selection{ background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }

body {
    background-color: #fff;
    margin: 40px;
    font: 13px/20px normal Helvetica, Arial, sans-serif;
    color: #4F5155;
}

a {
    color: #003399;
    background-color: transparent;
    font-weight: normal;
}

h1 {
    color: #444;
    background-color: transparent;
    border-bottom: 1px solid #D0D0D0;
    font-size: 19px;
    font-weight: normal;
    margin: 0 0 14px 0;
    padding: 14px 15px 10px 15px;
}

code {
    font-family: Consolas, Monaco, Courier New, Courier, monospace;
    font-size: 12px;
    background-color: #f9f9f9;
    border: 1px solid #D0D0D0;
    color: #002166;
    display: block;
    margin: 14px 0 14px 0;
    padding: 12px 10px 12px 10px;
}

#body{
    margin: 0 15px 0 15px;
}

</style>
</head>
<body>


<h1>IMAGE HERE</h1>

<div id="body">
    <br/>

    <p class="body">

    <?php
    echo form_open('start');
    $firstname = array(
    'name'  =>  'firstname',
    'value' =>  set_value('firstname')
    );

    $lastname = array(
    'name'  =>  'lastname',
    'value' =>  set_value('lastname')
    );

    $email = array(
    'name'  =>  'email',
    'value' =>  set_value('email')
    );

    $dateofbirth = array(
    'name'  =>  'dateofbirth',
    'value' =>  set_value('dateofbirth')
    );

    $gender = array(
    'name'  =>  'gender',
    'value' =>  set_value('gender'),
    'style' =>  'margin:10px'
    );

    $username = array(
    'name'  =>  'username',
    'value' =>  set_value('username')
    );

    $password = array(
    'name'  =>  'password',
    'value' =>  ''
    );

    $confpass = array(
    'name'  =>  'confpass',
    'value' =>  ''
    );


    ?>


    <strong>User Information: </strong>
    &nbsp;
    <div align="right"><font color="red">*</font>Denotes Required Field</div>

    <div align="left">
    First Name<font color="red">*</font>:
    <?php echo form_input($firstname)?>
    <br/>

    Last Name<font color="red">*</font>:
    <?php echo form_input($lastname)?>
    <br/>

    Email Address<font color="red">*</font>:
    <?php echo form_input($email)?>
    <br/>

    Date Of Birth:
    <?php echo form_input($dateofbirth)?>
    <br/>

    Gender:
        <?php 
        echo form_radio($gender, 'Male');
        echo "Male";
        echo form_radio($gender, 'Female'); 
        echo "Female";
        ?>
        <br/>



    <strong>Account Information:</strong><br/>


    Username<font color="red">*</font>:
    <?php echo form_input($username)?><br/>

    Password<font color="red">*</font>:
    <?php echo form_password($password)?><br/>

    Password Confirmation<font color="red">*</font>:
    <?php echo form_password($confpass)?><br/>

    <?php 
    echo validation_errors();?>
    <?php echo form_submit(array('name'=>'register'), 'Register');?>
    <?php echo form_reset(array('name'=>'reset'), 'Reset')?>

</div>

</body>
</html>

And this is my code for usermodel.php

<?php


class User_model extends CI_Model {
function User_model() {
parent::Model();
}
function register_user($firstname, $lastname, $email, $dateofbirth, $gender, $username, $password)
{
$sha1_password=sha1($password);
$query_str="INSERT INTO tbl_user(firstname, lastname, email, dateofbirth, gender, username, password) VALUES (?,?,?,?,?,?,?)";

$this->db->query-($query_str, array($firstname, $lastname, $email, $dateofbirth, $gender, $username, $sha1_password));

function check_exists_username($username)
{
$query_str = "SELECT username FROM tbl_user WHERE username = ?";
$result=$this->db->query->($query_str, $username);
if($result -> num_rows() > 0)
{
return true;
}
else
{
return false;
}
}
}

}

Thank you all in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:21:08+00:00Added an answer on June 14, 2026 at 1:21 am

    there is a syntax error in user.php

    $email=$this->input->post->('email');
    

    This should be

    $email=$this->input->post('email');
    

    I’m not sure why did you create username_not_exists() function inside register() action

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.