Ok I got a question. I realize it’s probably not even worthy of the lower echelon in scripting but then again i’m no master. So I make a simple script that posts information into my online database from an html form. It worked beautifully. I made another script using the exact same formatting (although it has more entries than the first) and it acts like it runs perfectly but when i check the database nothing is posted, just blanks. I welcome suggestions and appreciate your consideration. I iwll post the code below. first the smaller one that worked:
[php]
and the one that doesn’t work:
[php]<?php
define(‘DB_NAME’, ‘black44users’);
define(‘DB_USER’, ‘black44users’);
define(‘DB_PASSWORD’, ‘*****’);
define(‘DB_HOST’, ‘black44users.db.8631036.hostedresource.com’);
$link = mysql_connect(DB_HOST, DB_USER,DB_PASSWORD);
if (!$link) {
die('could not connect: ’ . mysql_error());
}
$db_selected = mysql_select_db(DB_NAME, $link);
if (!$db_selected) {
die('Can’t use ’ . DB_NAME . ’ : ’ . mysql_error());
}
$value1 = $_POST[‘first_name’];
$value2 = $_POST[‘last_name’];
$value3 = $_POST[‘address1’];
$value4 = $_POST[‘address2’];
$value5 = $_POST[‘city’];
$value6 = $_POST[‘state’];
$value7 = $_POST[‘zip’];
$value8 = $_POST[‘phone’];
$value9 = $_POST[‘email’];
$value10 = $_POST[‘email2’];
$value11 = $_POST[‘shippingfirst’];
$value12 = $_POST[‘shippinglast’];
$value13 = $_POST[‘shippingaddress1’];
$value14 = $_POST[‘shippingaddress2’];
$value15 = $_POST[‘shippingcity’];
$value16 = $_POST[‘shippingstate’];
$value17 = $_POST[‘shippingzip’];
$value18 = $_POST[‘cctype’];
$value19 = $_POST[‘ccnumber’];
$value20 = $_POST[‘ccexpiration’];
$value21 = $_POST[‘cccvv’];
$sql = “INSERT INTO customers (first_name, last_name, address1, address2, city, state, zip, phone, email, email2, shippingfirst, shippinglast, shippingaddress1, shippingaddress2, shippingcity, shippingstate, shippingzip, cctype, ccnumber, ccexpiration, cccvv) VALUES (’$VALUE1’, ‘$VALUE2’, ‘$VALUE3’, ‘$VALUE4’, ‘$VALUE5’,’$VALUE6’, ‘$VALUE7’, ‘$VALUE8’, ‘$VALUE9’, ‘$VALUE10’, ‘$VALUE11’, ‘$VALUE12’, ‘$VALUE13’, ‘$VALUE14’, ‘$VALUE15’, ‘$VALUE16’, ‘$VALUE17’, ‘$VALUE18’, ‘$VALUE19’, ‘$VALUE20’, ‘$VALUE20’)”;
if (!mysql_query($sql)) {
die('Error: ’ . mysql_error());
}
mysql_close();
?>
[/php]