php - custom WP form doesn't store any data -


i have custom word press form when fill , click submit blank page i'm expecting data stored in table in db , being forwarded next page

here html code+ form validation code(wp side) :

    <html>     <body> <form action="c:\xampp\htdocs\wordpress\process.php" method="post" name="myform"> name <input id="name" type="text" name="name" /> telephone <input id="telephone" type="text" name="telephone" /> fax <input id="fax" type="text" name="fax" /> web address <input id="webaddress" type="text" name="webaddress" /> state <input id="state" type="text" name="state" /> address <input id="address" type="text" name="address" /> <input type="submit" value="submit" /></form>     <\html>     <\body>   <script type="text/javascript">// <![cdata[ /* js validation code here */ function validateform() { /* validating name field */ var x=document.forms["myform"]["name"].value; if (x==null || x=="") { alert("name must filled out"); return false; } /* validating email field */ var x=document.forms["myform"]["telephone"].value;  if (x==null || x=="") { alert("telephone must filled out"); return false; } }  // ]]></script> 

and php data storage function:

<?php  //establish connection $con = mysqli_connect("localhost","xxx","xxx","android_app");  //on connection failure, throw error if(!$con) {   die('could not connect: '.mysql_error());  }  ?>  <?php  //get form elements , store them in variables $name=$_post["name"];  $telephone=$_post["telephone"];  $fax=$_post["fax"];  $webaddress=$_post["webaddress"];  $state=$_post["state"];  $address=$_post["address"];  ?>  <?php  $sql="insert `android_app`.`islamic_organisation` ( `name` , `telephone` , `fax` , `webaddress` , `state` , `address`) values ( '$name','$telephone', '$fax', '$webaddress' , '$state', '$address')";      mysqli_query($con,$sql);  ?>  <?php //redirects specified page header("location: http://localhost/wordpress/?page_id=857");  ?> 

i hope can give

thanks

wordpress doesn't seem input field names "name", "year" , few others.

try renaming field names more specific.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -