Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert PHP/MySql

Status
Not open for further replies.

rjsmith24

IS-IT--Management
Jul 22, 2003
4
US
This was working an hour ago... now it's all whacked- it won't error out, but it isn't inserting the record into the database either, and I cannot figure out why... I did everything by the book, and the code is very clean and structured. Here's the source code:

<html>
<body>

<?php
if ($submit) {
// Connect to DataBase
$link = mysql_connect(&quot;localhost&quot;, &quot;myname&quot;, &quot;mypass&quot;) or die(&quot;Could not connect : &quot; . mysql_error());
print &quot;Connected successfully&quot;;
mysql_select_db(&quot;sales&quot;) or die(&quot;Could not select database&quot;);
//Process Form
$sid = $_POST[&quot;sid&quot;];
$cid = $_POST[&quot;cid&quot;];
$ctn = $_POST[&quot;ctn&quot;];
$dot = $_POST[&quot;dot&quot;];
$pmtt = $_POST[&quot;pmtt&quot;];
$pamt = $_POST[&quot;pamt&quot;];

$sql = &quot;INSERT INTO customer (sales_id, customer_id, tn, user_date, paytype, payamount) VALUES ('$sid','$cid','$ctn','$dot', '$pmtt', '$pamt')&quot;;
$result = mysql_query($sql);

echo &quot;Thank you! Information entered.\n&quot;;
} else{
} // end if
?>

<form method=&quot;post&quot; action=&quot;<?php echo $PHP_SELF?>&quot;>
<center>
<TABLE>
<TR>
<TD>Sales ID</TD>
<TD>Customer ID</TD>
<TD>Telephone Number (no dashes)</TD>
<TD>Date Entered (yyyy-mm-dd)</TD>
</TR>

<TR>
<TD><input type=&quot;text&quot; name=&quot;sid&quot; maxlength=&quot;4&quot;></TD>
<TD><input type=&quot;text&quot; name=&quot;cid&quot; maxlength=&quot;6&quot;></TD>
<TD><input type=&quot;text&quot; name=&quot;ctn&quot; maxlength=&quot;10&quot;></TD>
<TD><input type=&quot;text&quot; name=&quot;dot&quot; maxlength=&quot;10&quot;></TD>
</TR>

<TR>
<TD> </TD>
<TD>Payment Type</TD>
<TD>Payment Amount</TD>
<TD> </TD>
</TR>

<TR>
<TD> </TD>
<TD><input type=&quot;text&quot; name=&quot;pmtt&quot; maxlength=&quot;15&quot;></TD>
<TD><input type=&quot;text&quot; name=&quot;pamt&quot; maxlength=&quot;6&quot;></TD>
<TD> </TD>
</TR>

<TR><td colspan=&quot;4&quot; align=&quot;center&quot;><input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit Sale&quot;></TD></TR>
</table>
</form>

<A href=&quot;insertmatrix.php&quot;>Reload Page</a>
</body>
</html>
 
Have you tried:

$result = mysql_query($sql) or die (mysql_error()); to seeif soemting is going wrong in the sql-query...

Don't eat yellow snow!
 
aditionally, put an
echo $sql;
before
$result = mysql_query($sql);
you'll see there the exact sql sentence mysql server is about to process...
 
Hmmmm. It works this morning.
Man I love technology. Incidentally, that echo line is great for troubleshooting- thanks for the tip!
-Robert
Debug, compile, drink... drink, drink, drink...
 
i am having the same problem. i tried the echo test right before $result & the sentence is lacking three variable that are in the form prior to the post to insertAd1.php. the code follows. please go easy. to say i'm a programmer is a stretch. i would have preferred to sign up as a hack jobber. the following variables don't post to the mysql database:

$Extra
$AContact1
$status

calcAd1.php (posts to insertAd1.php)

<?php

//Create short variable names for billing
$cbb=$HTTP_POST_VARS['cbb'];
$mwd=$HTTP_POST_VARS['mwd'];
$cbr=$HTTP_POST_VARS['cbr'];
$cbbd=$HTTP_POST_VARS['cbbd'];
$mwdd=$HTTP_POST_VARS['mwdd'];
$cbrd=$HTTP_POST_VARS['cbrd'];

if ($cbb == null && $mwd == null && $cbr == null && $cbbd == null && $mwdd == null && $cbrd == null)
{
include(&quot;header.php&quot;);
echo &quot;<br><br><br><font face=\&quot;Arial Narrow\&quot; size=\&quot;2\&quot; color=\&quot;#FF0000\&quot;><b>:: Please Go Back And Select A Publication! ::</b></font><br><br><br>
<input type=button value=\&quot;Go Back\&quot; onClick=\&quot;history.go(-1)\&quot;><br><br><br>&quot;;
include(&quot;footer.php&quot;);
exit;
}

//Calculate the Amount of Charge
$Amount = $cbb + $mwd + $cbr + $cbbd + $mwdd + $cbrd;
if($cbb > 0 && $mwd >0 )
$Amount = $Amount - 4;
elseif ($cbbd > 0 && $mwdd > 0 )
$Amount = $Amount - 8;


//Create variables from posting
$Description=$HTTP_POST_VARS['x_Description'];
$Company=$HTTP_POST_VARS['x_Company'];
$Address=$HTTP_POST_VARS['x_Address'];
$City=$HTTP_POST_VARS['x_City'];
$State=$HTTP_POST_VARS['x_State'];
$Zip=$HTTP_POST_VARS['x_Zip'];
$First_Name=$HTTP_POST_VARS['x_First_Name'];
$Last_Name=$HTTP_POST_VARS['x_Last_Name'];
$Phone=$HTTP_POST_VARS['x_Phone'];
$Fax=$HTTP_POST_VARS['x_Fax'];
$Email=$HTTP_POST_VARS['x_Email'];
$CardN=$HTTP_POST_VARS['CardN'];
$CardT=$HTTP_POST_VARS['CardT'];
$CardEM=$HTTP_POST_VARS['CardEM'];
$CardEY=$HTTP_POST_VARS['CardEY'];
$ExpD=&quot;$CardEM$CardEY&quot;;

//Create short variable names for ad
$Heading=$HTTP_POST_VARS['Heading'];
$Agency=$HTTP_POST_VARS['Agency'];
$Project1=$HTTP_POST_VARS['Project1'];
$Project2=$HTTP_POST_VARS['Project2'];
$Project3=$HTTP_POST_VARS['Project3'];
$Project4=$HTTP_POST_VARS['Project4'];
$Project5=$HTTP_POST_VARS['Project5'];
$Project6=$HTTP_POST_VARS['Project6'];
$Project7=$HTTP_POST_VARS['Project7'];
$Project8=$HTTP_POST_VARS['Project8'];
$Extra=$HTTP_POST_VARS['Extra'];
$Desired=$HTTP_POST_VARS['Desired'];
$ACompany=$HTTP_POST_VARS['ACompany'];
$AContact1=$HTTP_POST_VARS['AContact1'];
$AContact2=$HTTP_POST_VARS['AContact2'];
$AContact3=$HTTP_POST_VARS['AContact3'];
$AContact4=$HTTP_POST_VARS['AContact4'];
$AContact5=$HTTP_POST_VARS['AContact5'];
$AContact6=$HTTP_POST_VARS['AContact6'];

//Add stripslashes for preview
$Description= stripslashes($Description);
$Company= stripslashes($Company);
$Address= stripslashes($Address);
$City= stripslashes($City);
$State= stripslashes($State);
$Zip= stripslashes($Zip);
$First_Name= stripslashes($First_Name);
$Last_Name= stripslashes($Last_Name);
$Phone= stripslashes($Phone);
$Fax= stripslashes($Fax);
$Email= stripslashes($Email);
$CardN= stripslashes($CardN);
$CardT= stripslashes($CardT);
$CardEM= stripslashes($CardEM);
$CardEY= stripslashes($CardEY);
$Heading= stripslashes($Heading);
$Project1= stripslashes($Project1);
$Project2= stripslashes($Project2);
$Project3= stripslashes($Project3);
$Project4= stripslashes($Project4);
$Project5= stripslashes($Project5);
$Project6= stripslashes($Project6);
$Project7= stripslashes($Project7);
$Project8= stripslashes($Project8);
$Extra= stripslashes($Extra);
$Desired= stripslashes($Desired);
$ACompany= stripslashes($ACompany);
$AContact1= stripslashes($AContact1);
$AContact2= stripslashes($AContact2);
$AContact3= stripslashes($AContact3);
$AContact4= stripslashes($AContact4);
$AContact5= stripslashes($AContact5);
$AContact6= stripslashes($AContact6);

include(&quot;header.php&quot;);

?>

<!--END HEADER & MAIN NAVIGATION-->
<!--BEGIN MAIN CONTENT TABLE-->

<body>

<form name=&quot;Submit Ad&quot; method=&quot;post&quot; action=&quot;<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td width=&quot;3%&quot;> </td><br>
<td width=&quot;30%&quot; valign=&quot;top&quot;>
<font face=&quot;Arial Narrow&quot; size=&quot;5&quot; color=&quot;#000000&quot;><b>Billing Information:</b></font><br>
<?php if($Company == null || $Address == null || $City == null || $State == null || $Zip == null || $First_Name == null || $Last_Name == null || $Phone == null || $Email == null || $CardN == null || $CardT == null || $CardEM == null || $CardEY == null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;2\&quot; color=\&quot;#FF0000\&quot;>* Please Fill in Empty Fields!</font><br>&quot;;include(&quot;footer.php&quot;);exit;}?>
<?php if($Company != null && $Address != null && $City != null && $State != null && $Zip != null && $First_Name != null && $Last_Name != null || $Phone != null && $Email != null && $CardN != null && $CardT != null && $CardEM != null && $CardEY)
{echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;2\&quot; color=\&quot;#000000\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Description\&quot; value=\&quot;$Description\&quot;>Your $Description Total is:
<input type=\&quot;hidden\&quot; name=\&quot;x_Amount\&quot; value=\&quot;$Amount\&quot;>\$$Amount.00<br>
<input type=\&quot;hidden\&quot; name=\&quot;x_Company\&quot; value=\&quot;$Company\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Address\&quot; value=\&quot;$Address\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_City\&quot; value=\&quot;$City\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_State\&quot; value=\&quot;$State\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Zip\&quot; value=\&quot;$Zip\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_First_Name\&quot; value=\&quot;$First_Name\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Last_Name\&quot; value=\&quot;$Last_Name\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Phone\&quot; value=\&quot;$Phone\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Fax\&quot; value=\&quot;$Fax\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Email\&quot; value=\&quot;$Email\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Card_Num\&quot; value=\&quot;$CardN\&quot;>Card Number: $CardN<br>
<input type=\&quot;hidden\&quot; name=\&quot;CardT\&quot; value=\&quot;$CardT\&quot;>Card Type: $CardT<br>
<input type=\&quot;hidden\&quot; name=\&quot;x_Exp_Date\&quot; value=\&quot;$ExpD\&quot;>Card Exp: $CardEM/
<input type=\&quot;hidden\&quot; name=\&quot;CardEY\&quot; value=\&quot;$CardEY\&quot;>$CardEY</font><br>
<input type=\&quot;hidden\&quot; name=\&quot;cbb\&quot; value=\&quot;$cbb\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;mwd\&quot; value=\&quot;$mwd\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;cbr\&quot; value=\&quot;$cbr\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;cbbd\&quot; value=\&quot;$cbbd\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;mwdd\&quot; value=\&quot;$mwdd\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;cbrd\&quot; value=\&quot;$cbrd\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;status\&quot; value=\&quot;2\&quot;><br>&quot;;}?>

<input type=&quot;submit&quot; name=&quot;Submit Ad&quot; value=&quot;Submit Ad&quot;>
<input type=button value=&quot;Go Back&quot; onClick=&quot;history.go(-1)&quot;>
</td>
</p>
<td width=&quot;10%&quot; valign=&quot;top&quot; align=&quot;right&quot;><img src=&quot;../images/Adheight.gif&quot;></td>
<td width=&quot;18%&quot; border=&quot;2&quot; bordercolor=&quot;#000000&quot; valign=&quot;top&quot;>
<div align=&quot;center&quot;>
<img src=&quot;../images/Adwidth.gif&quot;><br>
<?php if($Heading != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;Heading\&quot; value=\&quot;$Heading\&quot;>$Heading</font><br>&quot;;}?>
<?php if($Project1 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;Project1\&quot; value=\&quot;$Project1\&quot;>$Project1</font><br>&quot;;}?>
<?php if($Project2 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;Project2\&quot; value=\&quot;$Project2\&quot;>$Project2</font><br>&quot;;}?>
<?php if($Project3 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;Project3\&quot; value=\&quot;$Project3\&quot;>$Project3</font><br>&quot;;}?>
<?php if($Project4 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;Project4\&quot; value=\&quot;$Project4\&quot;>$Project4</font><br>&quot;;}?>
<?php if($Project5 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;Project5\&quot; value=\&quot;$Project5\&quot;>$Project5</font><br>&quot;;}?>
<?php if($Project6 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;Project6\&quot; value=\&quot;$Project6\&quot;>$Project6</font><br>&quot;;}?>
<?php if($Project7 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;Project7\&quot; value=\&quot;$Project7\&quot;>$Project7</font><br>&quot;;}?>
<?php if($Project8 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;Project8\&quot; value=\&quot;$Project8\&quot;>$Project8</font><br>&quot;;}?>
<?php if($Extra != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;Extra\&quot; value=\&quot;$Extra\&quot;>$Extra</font><br>&quot;;}?>
<?php if($Desired != null) {echo &quot;<b><font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;Desired\&quot; value=\&quot;$Desired\&quot;>$Desired</font></b><br>&quot;;}?>
<?php if($ACompany != null) {echo &quot;<b><font face=\&quot;Arial Narrow\&quot; size=\&quot;4\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;ACompany\&quot; value=\&quot;$ACompany\&quot;>$ACompany</font></b><br>&quot;;}?>
<?php if($AContact1 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;AContact1\&quot; value=\&quot;$AContact1\&quot;>$AContact1</font><br>&quot;;}?>
<?php if($AContact2 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;AContact2\&quot; value=\&quot;$AContact2\&quot;>$AContact2</font><br>&quot;;}?>
<?php if($AContact3 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;AContact3\&quot; value=\&quot;$AContact3\&quot;>$AContact3</font><br>&quot;;}?>
<?php if($AContact4 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;AContact4\&quot; value=\&quot;$AContact4\&quot;>$AContact4</font><br>&quot;;}?>
<?php if($AContact5 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;AContact5\&quot; value=\&quot;$AContact5\&quot;>$AContact5</font><br>&quot;;}?>
<?php if($AContact6 != null) {echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;1\&quot; color=\&quot;#000000\&quot;><input type=\&quot;hidden\&quot; name=\&quot;AContact6\&quot; value=\&quot;$AContact6\&quot;>$AContact6</font><br>&quot;;}?><br>
</div>
</td>
<td width=&quot;20%&quot;> </td>
</tr>
</table>
</form>
</body>
<!-- END MAIN CONTENT TABLE-->
<!--BEGIN FOOTER-->

<?php

include(&quot;footer.php&quot;);

?>


and here is insertAd1.php (posts to mysql database)

<?php

include (&quot;../connect/connect.php&quot;);

$table = &quot;subbid_ads&quot;;

//Create short variables
$Description=$HTTP_POST_VARS['x_Description'];
$Amount=$HTTP_POST_VARS['x_Amount'];
$Company=$HTTP_POST_VARS['x_Company'];
$Address=$HTTP_POST_VARS['x_Address'];
$City=$HTTP_POST_VARS['x_City'];
$State=$HTTP_POST_VARS['x_State'];
$Zip=$HTTP_POST_VARS['x_Zip'];
$First_Name=$HTTP_POST_VARS['x_First_Name'];
$Last_Name=$HTTP_POST_VARS['x_Last_Name'];
$Phone=$HTTP_POST_VARS['x_Phone'];
$Fax=$HTTP_POST_VARS['x_Fax'];
$Email=$HTTP_POST_VARS['x_Email'];
$CardN=$HTTP_POST_VARS['x_Card_Num'];
$ExpD=$HTTP_POST_VARS['x_Exp_Date'];
$cbb=$HTTP_POST_VARS['cbb'];
$mwd=$HTTP_POST_VARS['mwd'];
$cbr=$HTTP_POST_VARS['cbr'];
$cbbd=$HTTP_POST_VARS['cbbd'];
$mwdd=$HTTP_POST_VARS['mwdd'];
$cbrd=$HTTP_POSt_VARS['cbrd'];
$Posted = time();
$Heading=$HTTP_POST_VARS['Heading'];
$Project1=$HTTP_POST_VARS['Project1'];
$Project2=$HTTP_POST_VARS['Project2'];
$Project3=$HTTP_POST_VARS['Project3'];
$Project4=$HTTP_POST_VARS['Project4'];
$Project5=$HTTP_POST_VARS['Project5'];
$Project6=$HTTP_POST_VARS['Project6'];
$Project7=$HTTP_POST_VARS['Project7'];
$Project8=$HTTP_POST_VARS['Project8'];
$Extra=$HTTP_P0ST_VARS['Extra'];
$Desired=$HTTP_POST_VARS['Desired'];
$ACompany=$HTTP_POST_VARS['ACompany'];
$AContact1=$HTTP_P0ST_VARS['AContact1'];
$AContact2=$HTTP_POST_VARS['AContact2'];
$AContact3=$HTTP_POST_VARS['AContact3'];
$AContact4=$HTTP_POST_VARS['AContact4'];
$AContact5=$HTTP_POST_VARS['AContact5'];
$AContact6=$HTTP_POST_VARS['AContact6'];
$status=$HTTP_P0ST_VARS['status'];

//Encode variables
$Description= urlencode($Description);
$Amount= urlencode($Amount);
$Company= urlencode($Company);
$Address= urlencode($Address);
$City= urlencode($City);
$State= urlencode($State);
$Zip= urlencode($Zip);
$First_Name= urlencode($First_Name);
$Last_Name= urlencode($Last_Name);
$Phone= urlencode($Phone);
$Fax= urlencode($Fax);
$Email= urlencode($Email);
$cbb= urlencode($cbb);
$mwd= urlencode($mwd);
$cbr= urlencode($cbr);
$cbbd= urlencode($cbbd);
$mwdd= urlencode($mwdd);
$cbrd= urlencode($cbrd);
$Heading= urlencode($Heading);
$Project1= urlencode($Project1);
$Project2= urlencode($Project2);
$Project3= urlencode($Project3);
$Project4= urlencode($Project4);
$Project5= urlencode($Project5);
$Project6= urlencode($Project6);
$Project7= urlencode($Project7);
$Project8= urlencode($Project8);
$Extra= urlencode($Extra);
$Desired= urlencode($Desired);
$ACompany= urlencode($ACompany);
$AContact1= urlencode($AContact1);
$AContact2= urlencode($AContact2);
$AContact3= urlencode($AContact3);
$AContact4= urlencode($AContact4);
$AContact5= urlencode($AContact5);
$AContact6= urlencode($AContact6);
$status= urlencode($status);

//Add slashes for mysql storage
$Description= addslashes($Description);
$Amount= addslashes($Amount);
$Company= addslashes($Company);
$Address= addslashes($Address);
$City= addslashes($City);
$State= addslashes($State);
$Zip= addslashes($Zip);
$First_Name= addslashes($First_Name);
$Last_Name= addslashes($Last_Name);
$Phone= addslashes($Phone);
$Fax= addslashes($Fax);
$Email= addslashes($Email);
$cbb= addslashes($cbb);
$mwd= addslashes($mwd);
$cbr= addslashes($cbr);
$cbbd= addslashes($cbbd);
$mwdd= addslashes($mwdd);
$cbrd= addslashes($cbrd);
$Heading= addslashes($Heading);
$Project1= addslashes($Project1);
$Project2= addslashes($Project2);
$Project3= addslashes($Project3);
$Project4= addslashes($Project4);
$Project5= addslashes($Project5);
$Project6= addslashes($Project6);
$Project7= addslashes($Project7);
$Project8= addslashes($Project8);
$Extra= addslashes($Extra);
$Desired= addslashes($Desired);
$ACompany= addslashes($ACompany);
$AContact1= addslashes($AContact1);
$AContact2= addslashes($AContact2);
$AContact3= addslashes($AContact3);
$AContact4= addslashes($AContact4);
$AContact5= addslashes($AContact5);
$AContact6= addslashes($AContact6);
$status= addslashes($status);


$query = &quot;INSERT INTO $table (Description, Amount, Company, Address, City, State, Zip, First_Name, Last_Name, Phone, Fax, Email, cbb, mwd, cbr, cbbd, mwdd, cbrd, Heading, Project1, Project2, Project3, Project4, Project5, Project6, Project7, Project8, Extra, Desired, ACompany, AContact1, AContact2, AContact3, AContact4, AContact5, AContact6, status, Posted)
VALUES ('$Description','$Amount','$Company','$Address','$City','$State','$Zip','$First_Name','$Last_Name','$Phone','$Fax','$Email','$cbb','$mwd','$cbr','$cbbd','$mwdd','$cbrd','$Heading','$Project1','$Project2','$Project3','$Project4','$Project5','$Project6','$Project7','$Project8','$Extra','$Desired','$ACompany','$AContact1','$AContact2','$AContact3','$AContact4','$AContact5','$AContact6','$status','$Posted')&quot;;

$result = @mysql_query($query);

if (!$result)
{

include(&quot;header.php&quot;);

echo &quot;<font face=\&quot;Arial Narrow\&quot; size=\&quot;2\&quot; color=\&quot;#666666\&quot;><b><br><br>:: Could Not Process Ad Order ::</font><br><br><br>&quot;;

include(&quot;footer.php&quot;);

}
else
{
//Decode variables
$Description= urldecode($Description);
$Amount= urldecode($Amount);
$Company= urldecode($Company);
$Address= urldecode($Address);
$City= urldecode($City);
$State= urldecode($State);
$Zip= urldecode($Zip);
$First_Name= urldecode($First_Name);
$Last_Name= urldecode($Last_Name);
$Phone= urldecode($Phone);
$Fax= urldecode($Fax);
$Email= urldecode($Email);

//Stripslashes for Submission
$Description= stripslashes($Description);
$Amount= stripslashes($Amount);
$Company= stripslashes($Company);
$Address= stripslashes($Address);
$City= stripslashes($City);
$State= stripslashes($State);
$Zip= stripslashes($Zip);
$First_Name= stripslashes($First_Name);
$Last_Name= stripslashes($Last_Name);
$Phone= stripslashes($Phone);
$Fax= stripslashes($Fax);
$Email= stripslashes($Email);

//Mail confirmations to both customer & us
mail(&quot;me@mydomain.com&quot;,
&quot;AD ORDER CONFIRMATION&quot;,
&quot;$First_Name $Last_Name from $Company ordered sub-bid ad!&quot;,
&quot;From: $First_Name $Last_Name <$Email>&quot;);

mail(&quot;$First_Name $Last_Name <$Email>&quot;,
&quot;mydomain.com&quot;,
&quot;$First_Name $Last_Name,

Thank you for ordering a sub-bid advertisement with :: ::
Your ad will post immediately. Upon approval of your credit card your ad will be
activated. If we have any questions we will contact you.
Once again, Thank You for doing business with :: ::


Sincerely,





me&quot;,

&quot;From: mydomain.com <ads@mydomain.com>&quot;);

//Post to authorize.net via perlauthnet.pl script
echo &quot;<body onLoad=\&quot;document.authnet_form.submit()\&quot;>
<form name=\&quot;authnet_form\&quot; method=\&quot;post\&quot; action=\&quot; <input type=\&quot;hidden\&quot; name=\&quot;x_Description\&quot; value=\&quot;$Description\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Amount\&quot; value=\&quot;$Amount\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Company\&quot; value=\&quot;$Company\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Address\&quot; value=\&quot;$Address\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_City\&quot; value=\&quot;$City\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_State\&quot; value=\&quot;$State\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Zip\&quot; value=\&quot;$Zip\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_First_Name\&quot; value=\&quot;$First_Name\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Last_Name\&quot; value=\&quot;$Last_Name\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Phone\&quot; value=\&quot;$Phone\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Fax\&quot; value=\&quot;$Fax\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Email\&quot; value=\&quot;$Email\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Card_Num\&quot; value=\&quot;$CardN\&quot;>
<input type=\&quot;hidden\&quot; name=\&quot;x_Exp_Date\&quot; value=\&quot;$ExpD\&quot;>
</form>
</body>&quot;;

}

mysql_close($link);

?>

please help!! i can't figure it out & it's driving me absolutely nuts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top