Jump to content

mgmoses

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mgmoses's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the good ideas but in rethinking it I will leave it as is. Maybe the user would want to go back and print the page that he filled out for his records? The info does go to a database but its not that big a deal to see duplicate records in my case.
  2. Hello all - I'm at the conclusion of my script and I have what I believe to be my last question. My html form posts to my php script, which directs the client to a "thank you" page. At that point I would like to make the html form page no longer available from their "back" button. The reason is I do not want them to be able to go back and submit the same form again. Does anyone know what code I could use to do this? Thanks for the help!
  3. :DOkay, I've figured it out and I have it working perfectly. I call the image at the very beginning of my script and echo the "wait" a few lines after. When the client hits "submit" the image and the "wait" message appear together at the same time on the screen. Here are the first lines which accomplished this. <?php echo '<img src="http://127.0.0.1/Test/ajax-loader.gif" alt="">'; //Define the input variables $Name = $_POST['Name']; $Ad1 = $_POST['Ad1']; $Ad2 = $_POST['Ad2']; $City = $_POST['City']; $State = $_POST['State']; $Zip5 = $_POST['Zip5']; $Zip4 = $_POST['Zip4']; $Email = $_POST['Email']; $AreaCode = $_POST['AreaCode']; $Phone3 = $_POST['Phone3']; $Phone4 = $_POST['Phone4']; $Ext = $_POST['Ext']; header("refresh:5;url=http://127.0.0.1/home/ThankYou.php"); echo "Please wait. Your order is processing"; Maybe this will help someone else.
  4. I'm sorry, I guess I did not supply enough details. My client fills out an html form which then posts to my php file. I assumed that the code would need to be with php since once the client hits "submit," php refreshes his browser for 5 seconds and directs his browser to the html "thank you" page. If I understand how this all works, I would need to call the image in the html upon submit (but I'm already validating data upon submit), or I thought php should call the image since it's already echoing "please wait." So.....can I use the code you supplied in my php file and does it call the image for 5 seconds? There is more php after that. Thanks again. Bear with me. I'm new to all this.
  5. Okay, I got the image that I want to use....Now what script do I use for php to display it for the same 5 seconds that I am echoing "please wait?"
  6. Hello everyone! I'm back again needing some help In my php script I refresh the client's screen for 5 seconds and then send them to a "thank you" page. During the refresh, I echo "Please wait. Your order is processing." My question is can I also have php display some kind of progress bar, or hourglass, at the same time it is echoing "please wait?" This would be for the 5 seconds. How would I do this? Below is the script. Thanks in advance for your help. header("refresh:5;url=http://127.0.0.1/home/ThankYou.php"); echo "Please wait. Your order is processing";
  7. Hooray, Hooray ! I removed the quotes and the database updated successfully! Thanks everyone for your help! In closing, does anyone know of a good tutorial which will teach me how to extract the data from the database in a format that I can design, i.e. I want each record to be printed out on a 81/2 x 11 piece of paper in a logical order. Thanks again.
  8. Ken...okay here is the result Problem with the query: INSERT INTO capture ('Name', 'Ad1', 'Ad2', 'City', 'State', 'Zip5', 'Zip4', 'Email', 'AreaCode', 'Phone3', 'Phone4', 'Ext', 'Item01Qty', 'Item02Qty', 'Item03Qty', 'Item04Qty', 'Item05Qty', 'Item06Qty', 'Item07Qty', 'Item01Total', 'Item02Total', 'Item03Total', 'Item04Total', 'Item05Total', 'Item06Total', 'Item07Total', 'Total_Purchase', 'NJ_Tax', 'SH_Charge', 'Amount_To_Pay', 'CC1', 'CC2', 'CC3', 'CC4', 'Expires' ) VALUES ('888888888', '', '', '', '', '', '', '888888888888', '8888', '8888', '8888', '', '2', '', '', '', '', '', '', '13.30', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '13.30', '0.00', '6.20', '19.50', '8888', '888', '8888', '8888', '8888' ) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Name', 'Ad1', 'Ad2', 'City', 'State', 'Zip5', 'Zip4', 'Email', 'AreaCode', 'Pho' at line 2 I am using EasyPHP 5.3 or so. Where do I get a manual? Do you think removing the single quote marks will solve this?
  9. Thomas, I added the change to the script that you indicated. Here is the script now: <?php //Define the input variables $Name = $_POST['Name']; $Ad1 = $_POST['Ad1']; $Ad2 = $_POST['Ad2']; $City = $_POST['City']; $State = $_POST['State']; $Zip5 = $_POST['Zip5']; $Zip4 = $_POST['Zip4']; $Email = $_POST['Email']; $AreaCode = $_POST['AreaCode']; $Phone3 = $_POST['Phone3']; $Phone4 = $_POST['Phone4']; $Ext = $_POST['Ext']; $Item01Qty = $_POST['Item01Qty']; $Item02Qty = $_POST['Item02Qty']; $Item03Qty = $_POST['Item03Qty']; $Item04Qty = $_POST['Item04Qty']; $Item05Qty = $_POST['Item05Qty']; $Item06Qty = $_POST['Item06Qty']; $Item07Qty = $_POST['Item07Qty']; $Item01Total = $_POST['Item01Total']; $Item02Total = $_POST['Item02Total']; $Item03Total = $_POST['Item03Total']; $Item04Total = $_POST['Item04Total']; $Item05Total = $_POST['Item05Total']; $Item06Total = $_POST['Item06Total']; $Item07Total = $_POST['Item07Total']; $Total_Purchase = $_POST['Total_Purchase']; $NJ_Tax = $_POST['NJ_Tax']; $SH_Charge = $_POST['SH_Charge']; $Amount_To_Pay = $_POST['Amount_To_Pay']; $CC1 = $_POST['CC1']; $CC2 = $_POST['CC2']; $CC3 = $_POST['CC3']; $CC4 = $_POST['CC4']; $Expires = $_POST['Expires']; //uncomment for debugging //print_r($_POST); //most sites have magic quotes on //but if they do not, this code simulates magic quotes if( !get_magic_quotes_gpc() ) { if( is_array($_POST) ) $_POST = array_map('addslashes', $_POST); } $error = array(); //make sure there is data in the name and email fields if( empty($_POST["Name"]) ) { $error["Name"] = "Your Name is required."; $Name = ""; } else $Name = $_POST["Name"]; if( empty($_POST["Email"]) ) { $error["email"] = "Please include your Email address."; $Email = ""; } else $Email = $_POST["Email"]; //we need to make sure the order total was calculated before using the submit button if( empty($_POST["Amount_To_Pay"]) ) $error["no_qty"] = "Please go back and calculate your order total and resubmit."; //we should have at least 1 item ordered in the form if( empty($_POST["Item01Qty"]) && empty($_POST["Item02Qty"]) && empty($_POST["Item03Qty"]) && empty($_POST["Item04Qty"]) && empty($_POST["Item05Qty"]) && empty($_POST["Item06Qty"]) && empty($_POST["Item07Qty"]) ) $error["no_qty"] = "Please enter at least 1 item to order."; if(count($error) ) { echo "An error occurred while processing your order."; echo "<br>\n"; echo "Please check the following error messages carefully, then click back in your browser and make corrections."; echo "<br>\n"; while(list($key, $val) = each($error)) { echo $val; echo "<br>\n"; } //stop everything as we have errors and should not continue exit(); } //we can store the order in a database as well $conn = mysql_connect ('127.0.0.1', 'Bruce', 'heatwave914') or die ('Could not connect'); mysql_select_db ('orders'); $query = "INSERT INTO capture ('Name', 'Ad1', 'Ad2', 'City', 'State', 'Zip5', 'Zip4', 'Email', 'AreaCode', 'Phone3', 'Phone4', 'Ext', 'Item01Qty', 'Item02Qty', 'Item03Qty', 'Item04Qty', 'Item05Qty', 'Item06Qty', 'Item07Qty', 'Item01Total', 'Item02Total', 'Item03Total', 'Item04Total', 'Item05Total', 'Item06Total', 'Item07Total', 'Total_Purchase', 'NJ_Tax', 'SH_Charge', 'Amount_To_Pay', 'CC1', 'CC2', 'CC3', 'CC4', 'Expires' ) VALUES ('$Name', '$Ad1', '$Ad2', '$City', '$State', '$Zip5', '$Zip4', '$Email', '$AreaCode', '$Phone3', '$Phone4', '$Ext', '$Item01Qty', '$Item02Qty', '$Item03Qty', '$Item04Qty', '$Item05Qty', '$Item06Qty', '$Item07Qty', '$Item01Total', '$Item02Total', '$Item03Total', '$Item04Total', '$Item05Total', '$Item06Total', '$Item07Total', '$Total_Purchase', '$NJ_Tax', '$SH_Charge', '$Amount_To_Pay', '$CC1', '$CC2', '$CC3', '$CC4', '$Expires' )"; mysql_query( $query ); echo "database updated"; mysql_close($conn); ?> It still does not work. Nothing is going into the database!?? :'( Somebody please help!
  10. Richard.....Okay I think I see what you're saying ----I removed the "$" in front of the column names. Here is the new code: <?php //Define the input variables $Name = $_POST['Name']; $Ad1 = $_POST['Ad1']; $Ad2 = $_POST['Ad2']; $City = $_POST['City']; $State = $_POST['State']; $Zip5 = $_POST['Zip5']; $Zip4 = $_POST['Zip4']; $Email = $_POST['Email']; $AreaCode = $_POST['AreaCode']; $Phone3 = $_POST['Phone3']; $Phone4 = $_POST['Phone4']; $Ext = $_POST['Ext']; $Item01Qty = $_POST['Item01Qty']; $Item02Qty = $_POST['Item02Qty']; $Item03Qty = $_POST['Item03Qty']; $Item04Qty = $_POST['Item04Qty']; $Item05Qty = $_POST['Item05Qty']; $Item06Qty = $_POST['Item06Qty']; $Item07Qty = $_POST['Item07Qty']; $Item01Total = $_POST['Item01Total']; $Item02Total = $_POST['Item02Total']; $Item03Total = $_POST['Item03Total']; $Item04Total = $_POST['Item04Total']; $Item05Total = $_POST['Item05Total']; $Item06Total = $_POST['Item06Total']; $Item07Total = $_POST['Item07Total']; $Total_Purchase = $_POST['Total_Purchase']; $NJ_Tax = $_POST['NJ_Tax']; $SH_Charge = $_POST['SH_Charge']; $Amount_To_Pay = $_POST['Amount_To_Pay']; $CC1 = $_POST['CC1']; $CC2 = $_POST['CC2']; $CC3 = $_POST['CC3']; $CC4 = $_POST['CC4']; $Expires = $_POST['Expires']; //uncomment for debugging //print_r($_POST); //most sites have magic quotes on //but if they do not, this code simulates magic quotes if( !get_magic_quotes_gpc() ) { if( is_array($_POST) ) $_POST = array_map('addslashes', $_POST); } $error = array(); //make sure there is data in the name and email fields if( empty($_POST["Name"]) ) { $error["Name"] = "Your Name is required."; $Name = ""; } else $Name = $_POST["Name"]; if( empty($_POST["Email"]) ) { $error["email"] = "Please include your Email address."; $Email = ""; } else $Email = $_POST["Email"]; //we need to make sure the order total was calculated before using the submit button if( empty($_POST["Amount_To_Pay"]) ) $error["no_qty"] = "Please go back and calculate your order total and resubmit."; //we should have at least 1 item ordered in the form if( empty($_POST["Item01Qty"]) && empty($_POST["Item02Qty"]) && empty($_POST["Item03Qty"]) && empty($_POST["Item04Qty"]) && empty($_POST["Item05Qty"]) && empty($_POST["Item06Qty"]) && empty($_POST["Item07Qty"]) ) $error["no_qty"] = "Please enter at least 1 item to order."; if(count($error) ) { echo "An error occurred while processing your order."; echo "<br>\n"; echo "Please check the following error messages carefully, then click back in your browser and make corrections."; echo "<br>\n"; while(list($key, $val) = each($error)) { echo $val; echo "<br>\n"; } //stop everything as we have errors and should not continue exit(); } //we can store the order in a database as well $conn = mysql_connect ('127.0.0.1', 'Bruce', 'heatwave914') or die ('Could not connect'); mysql_select_db ('orders'); $query = "INSERT INTO capture ('Name', 'Ad1', 'Ad2', 'City', 'State', 'Zip5', 'Zip4', 'Email', 'AreaCode', 'Phone3', 'Phone4', 'Ext', 'Item01Qty', 'Item02Qty', 'Item03Qty', 'Item04Qty', 'Item05Qty', 'Item06Qty', 'Item07Qty', 'Item01Total', 'Item02Total', 'Item03Total', 'Item04Total', 'Item05Total', 'Item06Total', 'Item07Total', 'Total_Purchase', 'NJ_Tax', 'SH_Charge', 'Amount_To_Pay', 'CC1', 'CC2', 'CC3', 'CC4', 'Expires' ) VALUES ('$Name', '$Ad1', '$Ad2', '$City', '$State', '$Zip5', '$Zip4', '$Email', '$AreaCode', '$Phone3', '$Phone4', '$Ext', '$Item01Qty', '$Item02Qty', '$Item03Qty', '$Item04Qty', '$Item05Qty', '$Item06Qty', '$Item07Qty', '$Item01Total', '$Item02Total', '$Item03Total', '$Item04Total', '$Item05Total', '$Item06Total', '$Item07Total', '$Total_Purchase', '$NJ_Tax', '$SH_Charge', '$Amount_To_Pay', '$CC1', '$CC2', '$CC3', '$CC4', '$Expires' )"; echo "database updated"; mysql_close($conn); ?> However, it still is not working! Here is the structure of my database in case you find it useful 127.0.0.1 orders capture Browse Structure SQL Search Tracking Insert Export Import Operations Empty Drop Field Type Collation Attributes Null Default Extra Action Number int(7) No None auto_increment Name varchar(30) latin1_general_ci No None Ad1 varchar(30) latin1_general_ci No None Ad2 varchar(30) latin1_general_ci No None City varchar(30) latin1_general_ci No None State varchar(2) latin1_general_ci No None Zip5 varchar(5) latin1_general_ci No None Zip4 varchar(4) latin1_general_ci No None Email varchar(30) latin1_general_ci No None AreaCode varchar(3) latin1_general_ci No None Phone3 varchar(3) latin1_general_ci No None Phone4 varchar(4) latin1_general_ci No None Ext varchar(10) latin1_general_ci No None Item01Qty varchar(3) latin1_general_ci No None Item02Qty varchar(3) latin1_general_ci No None Item03Qty varchar(3) latin1_general_ci No None Item04Qty varchar(3) latin1_general_ci No None Item05Qty varchar(3) latin1_general_ci No None Item06Qty varchar(3) latin1_general_ci No None Item07Qty varchar(3) latin1_general_ci No None Item01Total varchar(10) latin1_general_ci No None Item02Total varchar(10) latin1_general_ci No None Item03Total varchar(10) latin1_general_ci No None Item04Total varchar(10) latin1_general_ci No None Item05Total varchar(10) latin1_general_ci No None Item06Total varchar(10) latin1_general_ci No None Item07Total varchar(10) latin1_general_ci No None Total_Purchase varchar(10) latin1_general_ci No None NJ_Tax varchar(10) latin1_general_ci No None SH_Charge varchar(10) latin1_general_ci No None Amount_To_Pay varchar(10) latin1_general_ci No None CC1 varchar(4) latin1_general_ci No None CC2 varchar(4) latin1_general_ci No None CC3 varchar(4) latin1_general_ci No None CC4 varchar(4) latin1_general_ci No None Expires varchar(5) latin1_general_ci No None Check All / Uncheck All With selected: -------------------------------------------------------------------------------- Print view Relation view Propose table structure Track table Add field(s) At End of Table At Beginning of Table After Number Name Ad1 Ad2 City State Zip5 Zip4 Email AreaCode Phone3 Phone4 Ext Item01Qty Item02Qty Item03Qty Item04Qty Item05Qty Item06Qty Item07Qty Item01Total Item02Total Item03Total Item04Total Item05Total Item06Total Item07Total Total_Purchase NJ_Tax SH_Charge Amount_To_Pay CC1 CC2 CC3 CC4 Expires -------------------------------------------------------------------------------- Browse Structure SQL Search Tracking Insert Export Import Operations Empty Drop Indexes: Action Keyname Type Unique Packed Field Cardinality Collation Null Comment PRIMARY BTREE Yes No Number 0 A Create an index on columns + Details...Space usage Type Usage Data 0 B Index 1,024 B Total 1,024 B Row Statistics Statements Value Format dynamic Collation latin1_swedish_ci Rows 0 Next Autoindex 2 Creation Jun 09, 2010 at 12:52 PM Last update Jun 09, 2010 at 12:52 PM What do I do now? Please help. :'(
  11. Richard...Parts of your comments are cut off. However I think I got the jist of what you were thinking. Below is my code incorporating your comments, as I believe them to be. However, :'( it still does not post any data to the database!? <?php //Define the input variables $Name = $_POST['Name']; $Ad1 = $_POST['Ad1']; $Ad2 = $_POST['Ad2']; $City = $_POST['City']; $State = $_POST['State']; $Zip5 = $_POST['Zip5']; $Zip4 = $_POST['Zip4']; $Email = $_POST['Email']; $AreaCode = $_POST['AreaCode']; $Phone3 = $_POST['Phone3']; $Phone4 = $_POST['Phone4']; $Ext = $_POST['Ext']; $Item01Qty = $_POST['Item01Qty']; $Item02Qty = $_POST['Item02Qty']; $Item03Qty = $_POST['Item03Qty']; $Item04Qty = $_POST['Item04Qty']; $Item05Qty = $_POST['Item05Qty']; $Item06Qty = $_POST['Item06Qty']; $Item07Qty = $_POST['Item07Qty']; $Item01Total = $_POST['Item01Total']; $Item02Total = $_POST['Item02Total']; $Item03Total = $_POST['Item03Total']; $Item04Total = $_POST['Item04Total']; $Item05Total = $_POST['Item05Total']; $Item06Total = $_POST['Item06Total']; $Item07Total = $_POST['Item07Total']; $Total_Purchase = $_POST['Total_Purchase']; $NJ_Tax = $_POST['NJ_Tax']; $SH_Charge = $_POST['SH_Charge']; $Amount_To_Pay = $_POST['Amount_To_Pay']; $CC1 = $_POST['CC1']; $CC2 = $_POST['CC2']; $CC3 = $_POST['CC3']; $CC4 = $_POST['CC4']; $Expires = $_POST['Expires']; //uncomment for debugging //print_r($_POST); //most sites have magic quotes on //but if they do not, this code simulates magic quotes if( !get_magic_quotes_gpc() ) { if( is_array($_POST) ) $_POST = array_map('addslashes', $_POST); } $error = array(); //make sure there is data in the name and email fields if( empty($_POST["Name"]) ) { $error["Name"] = "Your Name is required."; $Name = ""; } else $Name = $_POST["Name"]; if( empty($_POST["Email"]) ) { $error["email"] = "Please include your Email address."; $Email = ""; } else $Email = $_POST["Email"]; //we need to make sure the order total was calculated before using the submit button if( empty($_POST["Amount_To_Pay"]) ) $error["no_qty"] = "Please go back and calculate your order total and resubmit."; //we should have at least 1 item ordered in the form if( empty($_POST["Item01Qty"]) && empty($_POST["Item02Qty"]) && empty($_POST["Item03Qty"]) && empty($_POST["Item04Qty"]) && empty($_POST["Item05Qty"]) && empty($_POST["Item06Qty"]) && empty($_POST["Item07Qty"]) ) $error["no_qty"] = "Please enter at least 1 item to order."; if(count($error) ) { echo "An error occurred while processing your order."; echo "<br>\n"; echo "Please check the following error messages carefully, then click back in your browser and make corrections."; echo "<br>\n"; while(list($key, $val) = each($error)) { echo $val; echo "<br>\n"; } //stop everything as we have errors and should not continue exit(); } //we can store the order in a database as well $conn = mysql_connect ('127.0.0.1', 'Bruce', 'heatwave914') or die ('Could not connect'); mysql_select_db ('orders'); $query = "INSERT INTO capture ('$Name', '$Ad1', '$Ad2', '$City', '$State', '$Zip5', '$Zip4', '$Email', '$AreaCode', '$Phone3', '$Phone4', '$Ext', '$Item01Qty', '$Item02Qty', '$Item03Qty', '$Item04Qty', '$Item05Qty', '$Item06Qty', '$Item07Qty', '$Item01Total', '$Item02Total', '$Item03Total', '$Item04Total', '$Item05Total', '$Item06Total', '$Item07Total', '$Total_Purchase', '$NJ_Tax', '$SH_Charge', '$Amount_To_Pay', '$CC1', '$CC2', '$CC3', '$CC4', '$Expires' ) VALUES ('$Name', '$Ad1', '$Ad2', '$City', '$State', '$Zip5', '$Zip4', '$Email', '$AreaCode', '$Phone3', '$Phone4', '$Ext', '$Item01Qty', '$Item02Qty', '$Item03Qty', '$Item04Qty', '$Item05Qty', '$Item06Qty', '$Item07Qty', '$Item01Total', '$Item02Total', '$Item03Total', '$Item04Total', '$Item05Total', '$Item06Total', '$Item07Total', '$Total_Purchase', '$NJ_Tax', '$SH_Charge', '$Amount_To_Pay', '$CC1', '$CC2', '$CC3', '$CC4', '$Expires' )"; echo "database updated"; mysql_close($conn); ?> Any more help would be greatly appreciated!!!
  12. Thanks Ken. However I am new to php and I really don't want to revamp so much script. I did make some minor changes myself and I am able to determine that the script is working but the data is not getting posted to the database. I was able to echo the query and it is picking up what I input into the html form. The data is just not going into the database! :'( My database is called "orders" and the table is now called "capture." Here is the script that I am using now: <?php //Define the input variables $Name = $_POST['Name']; $Ad1 = $_POST['Ad1']; $Ad2 = $_POST['Ad2']; $City = $_POST['City']; $State = $_POST['State']; $Zip5 = $_POST['Zip5']; $Zip4 = $_POST['Zip4']; $Email = $_POST['Email']; $AreaCode = $_POST['AreaCode']; $Phone3 = $_POST['Phone3']; $Phone4 = $_POST['Phone4']; $Ext = $_POST['Ext']; $Item01Qty = $_POST['Item01Qty']; $Item02Qty = $_POST['Item02Qty']; $Item03Qty = $_POST['Item03Qty']; $Item04Qty = $_POST['Item04Qty']; $Item05Qty = $_POST['Item05Qty']; $Item06Qty = $_POST['Item06Qty']; $Item07Qty = $_POST['Item07Qty']; $Item01Total = $_POST['Item01Total']; $Item02Total = $_POST['Item02Total']; $Item03Total = $_POST['Item03Total']; $Item04Total = $_POST['Item04Total']; $Item05Total = $_POST['Item05Total']; $Item06Total = $_POST['Item06Total']; $Item07Total = $_POST['Item07Total']; $Total_Purchase = $_POST['Total_Purchase']; $NJ_Tax = $_POST['NJ_Tax']; $SH_Charge = $_POST['SH_Charge']; $Amount_To_Pay = $_POST['Amount_To_Pay']; $CC1 = $_POST['CC1']; $CC2 = $_POST['CC2']; $CC3 = $_POST['CC3']; $CC4 = $_POST['CC4']; $Expires = $_POST['Expires']; //uncomment for debugging //print_r($_POST); //most sites have magic quotes on //but if they do not, this code simulates magic quotes if( !get_magic_quotes_gpc() ) { if( is_array($_POST) ) $_POST = array_map('addslashes', $_POST); } $error = array(); //make sure there is data in the name and email fields if( empty($_POST["Name"]) ) { $error["Name"] = "Your Name is required."; $Name = ""; } else $Name = $_POST["Name"]; if( empty($_POST["Email"]) ) { $error["email"] = "Please include your Email address."; $Email = ""; } else $Email = $_POST["Email"]; //we need to make sure the order total was calculated before using the submit button if( empty($_POST["Amount_To_Pay"]) ) $error["no_qty"] = "Please go back and calculate your order total and resubmit."; //we should have at least 1 item ordered in the form if( empty($_POST["Item01Qty"]) && empty($_POST["Item02Qty"]) && empty($_POST["Item03Qty"]) && empty($_POST["Item04Qty"]) && empty($_POST["Item05Qty"]) && empty($_POST["Item06Qty"]) && empty($_POST["Item07Qty"]) ) $error["no_qty"] = "Please enter at least 1 item to order."; if(count($error) ) { echo "An error occurred while processing your order."; echo "<br>\n"; echo "Please check the following error messages carefully, then click back in your browser and make corrections."; echo "<br>\n"; while(list($key, $val) = each($error)) { echo $val; echo "<br>\n"; } //stop everything as we have errors and should not continue exit(); } //we can store the order in a database as well $conn = mysql_connect ('127.0.0.1', 'Bruce', 'heatwave914') or die ('Could not connect'); mysql_select_db ('orders'); $query = "INSERT INTO capture VALUES (' ', '$Name', '$Ad1', '$Ad2', '$City', '$State', '$Zip5', '$Zip4', '$Email', '$AreaCode', '$Phone3', '$Phone4', '$Ext', '$Item01Qty', '$Item02Qty', '$Item03Qty', '$Item04Qty', '$Item05Qty', '$Item06Qty', '$Item07Qty', '$Item01Total', '$Item02Total', '$Item03Total', '$Item04Total', '$Item05Total', '$Item06Total', '$Item07Total', '$Total_Purchase', '$NJ_Tax', '$SH_Charge', '$Amount_To_Pay', '$CC1', '$CC2', '$CC3', '$CC4', '$Expires' )"; echo $query; mysql_close($conn); ?> Please give me your thoughts and suggestions as I am going to be bald soon after pulling out all my hair!
  13. Thanks Matthew! One of my variables was misspelled. That got rid of the undefined index. However, my data still does not post to my database. After the script runs, the browser goes blank and just hangs. My database is called Orders, using TableA. The variables listed in the database are in the same order as listed in the php file. Again, below is the script:<?php //Define the input variables $Name = $_POST['Name']; $Ad1 = $_POST['Ad1']; $Ad2 = $_POST['Ad2']; $City = $_POST['City']; $State = $_POST['State']; $Zip5 = $_POST['Zip5']; $Zip4 = $_POST['Zip4']; $Email = $_POST['Email']; $AreaCode = $_POST['AreaCode']; $Phone3 = $_POST['Phone3']; $Phone4 = $_POST['Phone4']; $Ext = $_POST['Ext']; $Item01Qty = $_POST['Item01Qty']; $Item02Qty = $_POST['Item02Qty']; $Item03Qty = $_POST['Item03Qty']; $Item04Qty = $_POST['Item04Qty']; $Item05Qty = $_POST['Item05Qty']; $Item06Qty = $_POST['Item06Qty']; $Item07Qty = $_POST['Item07Qty']; $Item01Total = $_POST['Item01Total']; $Item02Total = $_POST['Item02Total']; $Item03Total = $_POST['Item03Total']; $Item04Total = $_POST['Item04Total']; $Item05Total = $_POST['Item05Total']; $Item06Total = $_POST['Item06Total']; $Item07Total = $_POST['Item07Total']; $Total_Purchase = $_POST['Total_Purchase']; $NJ_Tax = $_POST['NJ_Tax']; $SH_Charge = $_POST['SH_Charge']; $Amount_To_Pay = $_POST['Amount_To_Pay']; $CC1 = $_POST['CC1']; $CC2 = $_POST['CC2']; $CC3 = $_POST['CC3']; $CC4 = $_POST['CC4']; $Expires = $_POST['Expires']; //uncomment for debugging //print_r($_POST); //most sites have magic quotes on //but if they do not, this code simulates magic quotes if( !get_magic_quotes_gpc() ) { if( is_array($_POST) ) $_POST = array_map('addslashes', $_POST); } $error = array(); //make sure there is data in the name and email fields if( empty($_POST["Name"]) ) { $error["Name"] = "Your Name is required."; $Name = ""; } else $Name = $_POST["Name"]; if( empty($_POST["Email"]) ) { $error["email"] = "Please include your Email address."; $Email = ""; } else $Email = $_POST["Email"]; //we need to make sure the order total was calculated before using the submit button if( empty($_POST["Amount_To_Pay"]) ) $error["no_qty"] = "Please go back and calculate your order total and resubmit."; //we should have at least 1 item ordered in the form if( empty($_POST["Item01Qty"]) && empty($_POST["Item02Qty"]) && empty($_POST["Item03Qty"]) && empty($_POST["Item04Qty"]) && empty($_POST["Item05Qty"]) && empty($_POST["Item06Qty"]) && empty($_POST["Item07Qty"]) ) $error["no_qty"] = "Please enter at least 1 item to order."; if(count($error) ) { echo "An error occurred while processing your order."; echo "<br>\n"; echo "Please check the following error messages carefully, then click back in your browser and make corrections."; echo "<br>\n"; while(list($key, $val) = each($error)) { echo $val; echo "<br>\n"; } //stop everything as we have errors and should not continue exit(); } //we can store the order in a database as well $link = @mysql_connect('localhost', 'Bruce', 'heatwave914'); if (!$link) { echo "Could not connect: " . mysql_error(); } else { mysql_select_db('orders'); $query = "INSERT INTO orders ('Number', 'Name', 'Ad1', 'Ad2', 'City', 'State', 'Zip5', 'Zip4', 'Email', 'AreaCode', 'Phone3', 'Phone4', 'Ext', 'Item01Qty', 'Item02Qty', 'Item03Qty', 'Item04Qty', 'Item05Qty', 'Item06Qty', 'Item07Qty', 'Item01Total', 'Item02Total', 'Item03Total', 'Item04Total', 'Item05Total', 'Item06Total', 'Item07Total', 'Total_Purchase', 'NJ_Tax', 'SH_Charge', 'Amount_To_Pay', 'CC1', 'CC2', 'CC3', 'CC4', 'Expires' )"; $query .= " VALUES ('', '$Name', '$Ad1', '$Ad2', '$City', '$State', '$Zip5', '$Zip4', '$Email', '$AreaCode', '$Phone3', '$Phone4', '$Ext', 'Item01Qty', 'Item02Qty', 'Item03Qty', 'Item04Qty', 'Item05Qty', 'Item06Qty', 'Item07Qty', 'Item01Total', 'Item02Total', 'Item03Total', 'Item04Total', 'Item05Total', 'Item06Total', 'Item07Total', 'Total_Purchase', 'NJ_Tax', 'SH_Charge', 'Amount_To_Pay', 'CC1', 'CC2', 'CC3', 'CC4', 'Expires' )"; //echo $query . "<br>\n"; $result = mysql_query($query); mysql_close($link); } ?> Thanks again for your help and assistance. I think I'm almost there!
  14. Please help. I do not know why I am getting an undefined index error message on line 7. I am using EasyPHP 5.3.2i. Line 7 reads "$Total_Purchase = $_POST['Total_Purchase']; $NJ_Tax = $_POST['NJ_Tax']; $SH_Charge = $_POST['SH_Charge']; $Amount_To_Pay = $_POST['Amount_To_Pay']; $CC1 = $_POST['CC1']; $CC2 = $_POST['CC2']; $CC3 = $_POST['CC3']; $CC4 = $_POST['CC4']; $Exp = $_POST['Exp'];" The script is as follows: <?php //Define the input variables $Name = $_POST['Name']; $Ad1 = $_POST['Ad1']; $Ad2 = $_POST['Ad2']; $City = $_POST['City']; $State = $_POST['State']; $Zip5 = $_POST['Zip5']; $Zip4 = $_POST['Zip4']; $Email = $_POST['Email']; $AreaCode = $_POST['AreaCode']; $Phone3 = $_POST['Phone3']; $Phone4 = $_POST['Phone4']; $Ext = $_POST['Ext']; $Item01Qty = $_POST['Item01Qty']; $Item02Qty = $_POST['Item02Qty']; $Item03Qty = $_POST['Item03Qty']; $Item04Qty = $_POST['Item04Qty']; $Item05Qty = $_POST['Item05Qty']; $Item06Qty = $_POST['Item06Qty']; $Item07Qty = $_POST['Item07Qty']; $Item01Total = $_POST['Item01Total']; $Item02Total = $_POST['Item02Total']; $Item03Total = $_POST['Item03Total']; $Item04Total = $_POST['Item04Total']; $Item05Total = $_POST['Item05Total']; $Item06Total = $_POST['Item06Total']; $Item07Total = $_POST['Item07Total']; $Total_Purchase = $_POST['Total_Purchase']; $NJ_Tax = $_POST['NJ_Tax']; $SH_Charge = $_POST['SH_Charge']; $Amount_To_Pay = $_POST['Amount_To_Pay']; $CC1 = $_POST['CC1']; $CC2 = $_POST['CC2']; $CC3 = $_POST['CC3']; $CC4 = $_POST['CC4']; $Exp = $_POST['Exp']; //uncomment for debugging //print_r($_POST); //most sites have magic quotes on //but if they do not, this code simulates magic quotes if( !get_magic_quotes_gpc() ) { if( is_array($_POST) ) $_POST = array_map('addslashes', $_POST); } $error = array(); //make sure there is data in the name and email fields if( empty($_POST["Name"]) ) { $error["Name"] = "Your Name is required."; $Name = ""; } else $Name = $_POST["Name"]; if( empty($_POST["Email"]) ) { $error["email"] = "Please include your Email address."; $Email = ""; } else $Email = $_POST["Email"]; //we need to make sure the order total was calculated before using the submit button if( empty($_POST["Amount_To_Pay"]) ) $error["no_qty"] = "Please go back and calculate your order total and resubmit."; //we should have at least 1 item ordered in the form if( empty($_POST["Item01Qty"]) && empty($_POST["Item02Qty"]) && empty($_POST["Item03Qty"]) && empty($_POST["Item04Qty"]) && empty($_POST["Item05Qty"]) && empty($_POST["Item06Qty"]) && empty($_POST["Item07Qty"]) ) $error["no_qty"] = "Please enter at least 1 item to order."; if(count($error) ) { echo "An error occurred while processing your order."; echo "<br>\n"; echo "Please check the following error messages carefully, then click back in your browser and make corrections."; echo "<br>\n"; while(list($key, $val) = each($error)) { echo $val; echo "<br>\n"; } //stop everything as we have errors and should not continue exit(); } //we can store the order in a database as well $link = @mysql_connect('localhost', 'Bruce', 'heatwave914'); if (!$link) { echo "Could not connect: " . mysql_error(); } else { mysql_select_db('orders'); $query = "INSERT INTO orders ('Number', 'Name', 'Ad1', 'Ad2', 'City', 'State', 'Zip5', 'Zip4', 'Email', 'AreaCode', 'Phone3', 'Phone4', 'Ext', 'Item01Qty', 'Item02Qty', 'Item03Qty', 'Item04Qty', 'Item05Qty', 'Item06Qty', 'Item07Qty', 'Item01Total', 'Item02Total', 'Item03Total', 'Item04Total', 'Item05Total', 'Item06Total', 'Item07Total', 'Total_Purchase', 'NJ_Tax', 'SH_Charge', 'Amount_To_Pay', 'CC1', 'CC2', 'CC3', 'CC4', 'Exp' )"; $query .= " VALUES ('', '$Name', '$Ad1', '$Ad2', '$City', '$State', '$Zip5', '$Zip4', '$Email', '$AreaCode', '$Phone3', '$Phone4', '$Ext', 'Item01Qty', 'Item02Qty', 'Item03Qty', 'Item04Qty', 'Item05Qty', 'Item06Qty', 'Item07Qty', 'Item01Total', 'Item02Total', 'Item03Total', 'Item04Total', 'Item05Total', 'Item06Total', 'Item07Total', 'Total_Purchase', 'NJ_Tax', 'SH_Charge', 'Amount_To_Pay', 'CC1', 'CC2', 'CC3', 'CC4', 'Exp' )"; //echo $query . "<br>\n"; $result = mysql_query($query); mysql_close($link); } ?> Also, my data is not posting to my database. Would appreciate your thoughts on that as well. Thanks a million in advance for your help!
  15. Thanks so much for your help. I added your recommendation and it seems to be working fine now.
×
×
  • 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.