html - PHP Code Not Entering Data Into Database -


I'm having trouble sending my format to my database I tried one hour to fix this issue is; I called my code "echoIscier ();" But no error was found, just due to the lack of new data in my database (it seems that the submission form does not have to send the information to reload the page) database, config.php, connectDB.php and header.php Works for the rest of my pages, so the problem is not in the database setup. I believe the error is within the "isset ($ _ POST ['submit']), because it returns from the page header Does not load, but I have all my code Only in the case I am providing (I know that this code is not protected from SQL injection, form validation is the next step after deciding it):

   ready ($ quo ); $ Statement- & gt; bind_param ('sss', $ name, $ email, $ content); Header ('location: /index.php'); $ Statement- & gt; Execute () $ statement- & gt; Store_salt (); SetuKiki ("name arrow", "", time () + 3600); Setkey ("email err", "", time () + 3600); Setuqi ("content arrow", "", time () + 3600); Setuqi ("content accept", "announce request successful", time () + 3600); Header ('location: /request.php'); }? & Gt; & Lt; Div id = "main" & gt; & Lt; Ol & gt; & Lt; Li & gt; & Lt; Label = "name" & gt; Name: & lt; / Label & gt; & Lt; Input type = "text" name = "name" value = "" id = "name" /> & Lt; Span class = "error" & gt; * & Lt ;? Php if (isset ($ _ cookie ["nameErr"])) {echo $ _COOKIE ["nameErr"];}? & Gt; & Lt; / Span & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Label = "email" & gt; Email: & lt; / Label & gt; & Lt; Input type = "text" name = "email" value = "" id = "email" style = "position: relative; left: 3px;" /> & Lt; Span class = "error" style = "status: relative; left: 3px;" & Gt; * & Lt ;? Php if (isset ($ _ cookie ["emailer"])) {echo $ _COOKIE ["emailErr"]; } & Gt; & Lt; / Span & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Label = "content" & gt; Requested announcement: & lt; / Labels & gt; & Lt; Br> & Lt; Textarea rows = "18" cols = "140" name = "content" id = "content" & gt; & Lt; / Textarea & gt; & Lt; Br> & Lt; Span class = "error" & gt; & Lt ;? Php if (isset ($ _COOKIE ["contentErr"])) {echo $ _COOKIE ["contentErr"];}? & Gt; & Lt; / Span & gt; & Lt; Span class = "error" & gt; & Lt ;? Php if (isset ($ _COOKIE ["contentSucc"])) {echo $ _COOKIE ["contentSucc"];}? & Gt; & Lt; / Span & gt; & Lt; / Li & gt; & Lt; / Ol & gt; & Lt; Input type = "submit" name = "submit" value = "submit" style = "position: relative; left: 40px;" / & Gt; & Lt ;! - onclick = "window.location = 'request.php';" - & gt; & Lt; P & gt; & Lt; One class = "cancel" href = "index.php" style = "position: relative; left: 40px;" & Gt; Cancel & lt; / A & gt; & Lt; / P & gt; & Lt; / Div & gt;    

  1. Redirecting to another webpage before executing SQL.
  2. You do not have a semicolon at the end of the line.
  3. You have & lt; Form & gt; gt; Tags
  4. You should not do too much to prevent SQL injection. Unless your MySQLi is used properly, you are OK.

    Change it

      $ statement-> bind_param ('sss', $ name, $ email, $ content); Header ('location: /index.php'); $ Statement-> Execute ()   

    this

      $ statement-> Bind_param ('sss', $ name, $ email, $ content); $ Statement & gt; Executed (); $ Statement & gt; near (); Header ('location: /index.php');    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -