php - Why am I still getting 500 internal server error in Codeigniter? -
Read this question before trying to vote it below. There are so many duplicates of questions and unfortunately none of them work for me.
I am using the CodeIgniter_2.1.4 version.
I have a simple registration form and I need to put its data in DB through an Ajax request. When there are no errors in the form:
POST path / index.php / controller / method 500 (internal server error)
I have the following I have tried the solution but I still get the error:
- I have enabled CSFR protection in my
config.php
file:$ config ['Csrf_protection'] = TRUE;
- I am using the
form_open ()
andform_close ()
tag, because the CI documentation says it's automatic In the hidden CSRF field, the form ifform_open ()
is used. Submit javascript$ ("# sign-up") (function (e) {e.preventDefault ( ); Alert ($ (this). Certificate ()); $ .XX ({method: "post", data: $ (this). (), Url: "& lt ;? php echo site_url ('viewer / signup_pros ')? & Gt; "Success: Function (Data) {$ (" #Update "). Html (Data);}})}}); Public code signup_process () {$ this- & gt; Form_validation- & gt; Set_rules ("firstname"
PHP code
, "first name (required"); $ this- & gt; ; Form_validation- & gt; set_rules ("nickname", "last name", "required"); $ this-> form_validation- & gt; set_rules ("user name", "username", "required | max- Length [10] "); $ this-> form_validation- & gt; set_rules (" password "" password "," required | minute-length [5] "); $ this-> form_validation- & gt; Set_rules ("telephone", "telephone", "required"); $ this-> form_validation- & gt; set_rules ("email", "email", "required | vALID_EMAIL"); $ this- & gt; form_validation - & gt; set_riels ("Terms", "Terms and Conditions" ("$ $"); // errors ($$-> form_validation-> run ()) {// errors are $ data ["title"] = "errors"; $ data ["errors"] = Verification_Rursers (); $ this-> Load-> View ("Public / Errors", $ data);} Other {$ viewer = array ("first name" => gt; $ -> this- & gt; ; Input-> Post ("First Name"), "Last Name" => $ -> -> Input-> ), "Username" = & gt; $ This- & gt; Input-> Post ("username"), "password" = & gt; $ This- & gt; Encryption-> Sha1 ($ this-> Input-> Post ("password"), "telephone" = & gt; $ -> this- & gt; Input-> Post ("Telephone"), "Email" = & gt; $ This- & gt; Input-> )); $ Create_result = $ this- & gt; Viewer_model- & gt; Create_viewer ($ viewer); If ($ create_result) {$ data ["message"] = "Registration successful ... please sing in"; $ This- & gt; Load-> View ("Public / Success", $ data); }}}
What could be the reason for this?
method: "post ",
to
try
Comments
Post a Comment