Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Submit Form Not Processing

$
0
0

Hi all,

 

I have created a form that is submitting to my database. I have adjusted some of my submit script that I am using on my registration for to submit the data captured on the form, but for some reason the data isn't being captured into my database table.

 

Here is my code:

FORM:

<div id="container">
		<div id="content" style="margin-top:-45px;">
		<img src="images/logo.png" alt="TechDesignLab"></img>
			<h1>Auxilium</h1>
			
		
		<div id="stylized" class="form">
			<form id="form" name="form" method="post" action="process/submit_walkin.php">
			<h1>Walkin Customer Details</h1>
			<p>This is the basic form layout. We can edit it as required.</p>

			
			<label>User Logged In :
			<span class="small">You are logged in as</span>
			</label>
			<input type="text" name="name" id="name" value="<?php echo htmlentities($_SESSION['username']);?>" disabled>
			
			
			
			<label>Customer Name :
			<span class="small">Add the customer's name</span>
			</label>
			<input type="text" name="name" id="name"/>

			
			<label>Customer Surname :
			<span class="small">Add the customer's surname</span>
			</label>
			<input type="text" name="name" id="name"/>


			<label>Contact Number :
			<span class="small">Add a contact number</span>
			</label>
			<input type="text" name="email" id="email" />


			<label>E-Mail :
			<span class="small">Add an e-mail address</span>
			</label>
			<input type="text" name="password" id="password" />


			<label>Query Type :
			<span class="small">Select a query type</span>
			</label>
			<select id="select1" name="select1">
				<option value=""> -- Select the query Type --</option>
				<option value="3rd Party">3rd Party</option>
				<option value="Cashier">Cashier</option>
				<option value="Client Liaison Consultant">Client Liaison Consultant</option>
				<option value="Credit Control Consultant">Credit Control Consultant</option>
				<option value="Insurance Consultant">Insurance Consultant</option>
				<option value="Manager">Manager</option>
				<option value="Meeting/Interview">Meeting/Interview</option>
				<option value="Premier Client Consultant">Premier Client Consultant</option>
				<option value="Retail Shop Consultant">Retail Shop Consultant</option>
				<option value="Retention Collection">Retention Collection</option>
				<option value="Tech Deck Consultant">Tech Deck Consultant</option>
			</select>

			<input type="button" value="Submit" class="bt_login" onclick="formhash(this.form, this.form.password);"/> 
			</form></div>
			
		<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
		</div><!-- / content -->		
	</div><!-- / container -->
</body>



<div id="container">
<div id="footer" style="margin-top:10px;">

<footer style="background:#E5E5E5; height:20px">
  <p>Copyright © TechDesignLab 2014 | <a href="mailto:leon.claassen@techdesignlab.co.za">Contact Us</a>.</p>
  <img src="images/logo.png" alt="Footer Logo" align="left"></img>
  <img src="images/level2.png" alt="level2" align="left"></img>
</footer>
</div><!-- / footer -->		
</div><!-- / container -->
</html>

My Submit Code:

<!-- process/submit_walkin.php -->


<?php
include_once '../includes/db_connect.php';
include_once '../includes/psl-config.php';

$error_msg = "";

if (isset($_POST['username'], $_POST['fname'], $_POST['lname'], $_POST['msisdn'], $_POST['email'], $_POST['query1'])) 
{
    // SANITIZE AND VALIDATE THE DATA BEING PROCESSED BY THE FORM
		$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
		$fname = filter_input(INPUT_POST, 'fname', FILTER_SANITIZE_STRING);
		$lname = filter_input(INPUT_POST, 'lname', FILTER_SANITIZE_STRING);
		$email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
		$query1 = filter_input(INPUT_POST, 'query1', FILTER_SANITIZE_STRING);
		$email = filter_var($email, FILTER_VALIDATE_EMAIL);

  

    $stmt = $mysqli->prepare($prep_stmt);

    // TODO: 
    // We'll also have to account for the situation where the user doesn't have
    // rights to do registration, by checking what type of user is attempting to
    // perform the operation.

    if (empty($error_msg)) 
	{
        // Insert the new user into the database 
        if ($insert_stmt = $mysqli->prepare("INSERT INTO walkin (username, fname, lname, msisdn, email, query1, creation_time) 
														 VALUES (?, ?, ?, ?, ?, ?, now())")) 
		{
            $insert_stmt->bind_param($fname, $lname, $msisdn, $email, $query1, $creation_time);
            // Execute the prepared query.
            if (! $insert_stmt->execute()) 
			{
                header('Location: ../error.php?err=Registration failure: INSERT');
            }
        }
        header('Location: ./success.html');
    }
}

?>



Viewing all articles
Browse latest Browse all 13200

Trending Articles