Custom form
-
I’m creating some custom pages which contains forms.
In my wordpress file (myTempalte.php), I have the following code:
(...) <div class="contentbox470px floatLeft"> <h3><?php _e('Foresl? butikk','StoreLocator');?></h3> <?php include_once 'includes/storeLocator/frm_store.php' ?> </div> (...)
My frm_store.php looks like this:
<form id="store_data_form" class="appnitro" method="post" action="includes/process_frm_store.php"> <input id="store_name" name="store_name" type="text" maxlength="40" value=""/> <input id="store_street1" name="store_street1" class="textfield65pc" value="" maxlength="50" type="text"> <input id="saveForm" class="submitButton" type="submit" name="save" value="Submit Form" /> <input id="clearForm" class="clearButton" type="reset" name="clear" value="Reset form" /> </form>
My process_frm_store.php looks like this:
<?php $myDB = new DAL(); $myDB->connect(); if (isset($_POST['save'])) { $formData = array( "name"=> mysql_real_escape_string($_POST['store_name']), "street1"=> mysql_real_escape_string($_POST['store_street1']) $result = $myDB->addNewStore($formData); echo $result; } ?>
My SQL function looks like this:
public function addNewStore($formData) { $sql ="INSERT INTO sl_store(name, street1, street2, zipcode_id, phone, fax, www, email, opening_hours, active, descriptionID)"; $sql .="VALUES('". $formData['name']."',". $formData['street1']."')"; $this->query_result = mysql_query($sql, $this->conn); if($this->query_result) return $this->query_result; else return "Insertion failed"; }
My problem is that nothing happends.
Nothing is inserted into the database, and the function is not returning anything.Are there any better ways of doing this?
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Custom form’ is closed to new replies.