My sign up form was previously working well. However, I had to add an acceptance page or terms and conditions before sign up can be successful. I thought it would be better to include it in sign up page rather than after sign up (before being presented with member's homepage). Problem is, it's having a lot of issues. It's not working properly.
Here's my code in view page: (i added this at the bottom of all fields before sign up button)
Please proceed only if you accept our <a target="blank" href="<?php site_url("in/terms_and_conditions");?>">terms and conditions</a>.
<input type='checkbox' name='terms' value='checked' id='terms' required autofocus/><br/>
Right now, it seems to work fine (codeigniter built in validation prompts up a message telling the user to click before he can proceed). Issue is 1. the link ("in/terms_and_conditions") does not show properly. Whenever the corresponding text is clicked, instead of showing the proper page, it just opens up a new sign up page. Second issue is the presence of errors as follows: Message: Undefined index: c_terms in model Line Number: 24 Line 24 is this:
'terms'=> $post_obj['c_terms']
I tried to add this to my array. Was it actually correct? The second error shown is:
Column 'terms' cannot be null
INSERT INTO `client` (`first_name`, `last_name`, `email_address`, `password`, `address`, `tagline`, `profile`, `interests`, `billing_mode`, `terms`) VALUES ('dsfhkds', 'hfdskhflk', 'test@yahoo.com', '123456', 'fsdkfhsdk', 'sdkfhsdkf', 'sdklhfslkdhflsdhf', 'kdslhflks', 'Escrow', NULL)
What I did to my original table is I added column which I named "terms", set it to text type and no default value.
Please help me fix this.
Thanks!
Issue 1: Did you create the page "in/terms_and_conditions" ? make sure?
Controller Name: in
Action Name : terms_and_conditions
Issue 2: You have named checkbox as "terms". then, you should get the posted value as follows
'terms'=> $post_obj['terms']
Issue 3: Set "terms" column default value as "NULL"
I see three problems:
You're not echoing the result of the site_url
function. Just put echo
in front of it.
If $post_obj
is your '$_POST array you have to use the
name` attribute of the HTML input as the key:
'terms' => $post_obj['terms']
Your problem is that you're not setting any text to be saved in terms
. Add it to the second parameter of $this->db->insert('table', $data)
like this: $data['terms'] = '...'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.