Jump to content

What's wrong


dudejma

Recommended Posts

I have a form that I'm wanting to insert into my database. This is the form:

 

<!-- Text container -->
			<div class="contentbox-container">
				<div class="contentbox-full">
		 			<div class="contentbox-title-shading-small bg-blue04 box-on"> </div>
					<div class="contentbox-title-shading-small">Personal Information</div>
        		<div class="contentbox-noshading">
          		<form action="insert.php" action="post">
<p><b>NOTE</b>: Only register if you are planning on using our services. The only point in registering is to access the invoice system.</p>
First Name: <input type="text" name="firstname" value=""> Last Name: <input type="text" name="lastname" value=""> <br />
<br />
Address: <input type="text" size="40" name="address" value=""> <br />
<br />
City: <input type="text" name="city" value="">, State: <input type="text" name="state" value=""> <br />
<br />
Zip: <input type="text" name="zip" value=""> <br />
<br />
Phone Number: <input type="text" name="phone" value=""> <br />
<br />
Email: <input type="text" name="email" value=""> <br />
                                        
					</div>
        	</div>
      	</div>

<!-- Text container -->
			<div class="contentbox-container">
				<div class="contentbox-full">
		 			<div class="contentbox-title-shading-small bg-blue04 box-on"> </div>
					<div class="contentbox-title-shading-small">Account Information</div>
        		<div class="contentbox-noshading">
Username: <input type="text" name="username" value=""> <br />
<br />
Password: <input type="password" name="password" value=""> <br />
<br />
Password again: <input type="password" name="password2" value=""> <br />
<br />
<input type="submit" value="Submit"> <input type="reset" value="Reset">
</form>
					</div>
        	</div>
      	</div>
</div>
      

 

insert.php

<?php
$con = mysql_connect("localhost","virtu857_newuser","mypassword");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("virtu857_newusers", $con);

$sql="INSERT INTO Users (firstname, lastname, address, city, state, zip, phone, email,  username, password)
VALUES
('$_POST[firstname]','$_POST[lastname]','$_POST[address]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[phone]','$_POST[email]','$_POST[username]','$_POST[password]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
header( 'Location: http://aandwtechsupport.co.cc/registered.html' ) ;

mysql_close($con)
?> 

 

It redirects me to the completion page, but doesn't actually insert the data. It insert's blank fields.

Link to comment
https://forums.phpfreaks.com/topic/207313-whats-wrong/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.