Click here to Skip to main content
15,923,051 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: How can I store an image to the database's field ? Pin
Hari Om Prakash Sharma6-Jul-08 23:26
Hari Om Prakash Sharma6-Jul-08 23:26 
GeneralRe: How can I store an image to the database's field ? Pin
Mohammad Dayyan8-Jul-08 23:21
Mohammad Dayyan8-Jul-08 23:21 
GeneralRe: How can I store an image to the database's field ? Pin
Hari Om Prakash Sharma9-Jul-08 1:44
Hari Om Prakash Sharma9-Jul-08 1:44 
AnswerRe: How can I store an image to the database's field ? Pin
Marc Firth15-Jul-08 2:40
Marc Firth15-Jul-08 2:40 
GeneralRe: How can I store an image to the database's field ? Pin
Mohammad Dayyan3-Aug-08 10:21
Mohammad Dayyan3-Aug-08 10:21 
QuestionFunction return XML object.... unable to parse it to javascript Pin
Y_Kaushik25-Jun-08 19:42
Y_Kaushik25-Jun-08 19:42 
AnswerRe: Function return XML object.... unable to parse it to javascript Pin
Mohammad Dayyan3-Aug-08 10:46
Mohammad Dayyan3-Aug-08 10:46 
QuestionCan someone help me spot check this form code? Pin
bschm7825-Jun-08 19:27
bschm7825-Jun-08 19:27 
I am writing a simple form for a website I am developing and I keep getting parse errors, mostly dealing with quotes around HTML tags. Here is my code - any guidance would be appreciated. The errors I am getting are creeping up between the following 2 comment tags, to make it easier to identify:

///////////////////////////////////////////////////////
//check for existence of missing fields/error messages
///////////////////////////////////////////////////////

and

/* commented this out for testing of first part of script

/////////////////////////////
// WRITE DATA TO MYSQL table
/////////////////////////////

Here's my code:

<HTML>
<HEAD>
<TITLE>SHIRT SCRIPT</TITLE>
</HEAD>
<BODY>

<?php

include ("validation_functions.php4");
function shirtsSetup()
{
////////////////////////////////////////
//GET VALUES FROM SHIRT PORTION OF FORM
////////////////////////////////////////
$name = ($_POST['name']);
$address = ($_POST['address']);
$city = ($_POST['city']);
$state = ($_POST['state']);
$zip = ($_POST['zip']);
$email = ($_POST['email']);
$phone = ($_POST['phone']);
$quantity = ($_POST['quantity']);
$size = ($_POST['size']);
$color = ($_POST['color']);
$price = 15;
$shirtTotalPrice = $price * $quantity;
$instructions = ($_POST['instructions']);
$paypal = ($_POST['paypal']);
$check = ($_POST['check']);
$to = "myemail@yahoo.com";
$subject = "OMN T-Shirt order";
$message= "$name\n$address\n$city\n$state\n$zip\n$phone\n$email\n$phone\nquantity\n$size\n$color\n$instructions";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";


//////////////////////////////
//CHECK FOR ERRONEOUS FIELDS.
//////////////////////////////

$error_msg = array();

$valid = verifyAlphaNum($name);
if(!valid) {
$error_msg[] = "Name must be letters, spaces, dashes and ' only";
}

$valid = verifyAlphaNum($address);
if(!valid) {
$error_msg[] = "Address must be letters, numbers, spaces, dashes and ' only";
}

$valid = verifyAlphaNum($city);
if(!valid) {
$error_msg[] = "City must be letters, spaces, dashes and ' only";
}

$valid = verifyAlphaNum($state);
if(!valid) {
$error_msg[] = "State must be two letters only";
}

$valid = verifyAlphaNum($zip);
if(!valid) {
$error_msg[] = "Zip must contain five numbers only";
}

$valid = verifyEmail($email);
if(!valid) {
$error_msg[] = "Email must be a valid format";
}



///////////////////////////////////////////////////////
//check for existence of missing fields/error messages
///////////////////////////////////////////////////////

if($error_msg)

{

echo "<ul>\n";

foreach($error_msg as $err) {

echo "<div align = "center"><li>" .$err. "<li>\n</div>";

}

echo "<div align = "center"></ul>\n</div>";

}

else


if (!$error_msg )&& ($paypal == 'on')

{

mail($to, $subject, $message, $headers);
echo "<div align = "center">Your Order: " .$size. " .$color. ".$quantity. ".$shirtTotalPrice. "<br /></div>";

}

/* commented this out for testing of first part of script

/////////////////////////////
// WRITE DATA TO MYSQL table
/////////////////////////////

mysql_select_db(database name, connection pointer) or die (Unable to select database.");
mysql_query('INSERT into TABLE_NAME (Name, Address, City, State, Zip, Email, Phone, Quantity, Size, Color, Instructions) VALUES ($name, $address $city, $state, $zip, $email, $phone, $quantity, $size, $color, $instructions)', $connectID) or die ("Unable to insert records into database.");
header ('Refresh: 3; URL = http://www.paypal.com');//REDIRECT TO PAYPAL.COM
exit();
}

else

if (!$error_msg )&& ($check == 'on')

{

mail($to, $subject, $message, $headers);
echo "Thank you for your order! Please allow 2-3 weeks shipping time.<br />"
Order will be shipped upon receipt of check.";
header ('Refresh: 3; URL = http://www.mypage.com'); //REDIRECT TO HOME

}

*/

}

?>

</BODY>
</HTML>
AnswerRe: Can someone help me spot check this form code? Pin
help as an alias25-Jun-08 20:14
help as an alias25-Jun-08 20:14 
GeneralRe: Can someone help me spot check this form code? Pin
bschm7826-Jun-08 3:11
bschm7826-Jun-08 3:11 
GeneralRe: Can someone help me spot check this form code? Pin
alex.barylski1-Jul-08 10:26
alex.barylski1-Jul-08 10:26 
GeneralRe: Can someone help me spot check this form code? Pin
bschm783-Jul-08 6:21
bschm783-Jul-08 6:21 
Questionp0wned Pin
Christian Graus16-Jun-08 15:02
protectorChristian Graus16-Jun-08 15:02 
AnswerRe: p0wned Pin
Scott Dorman16-Jun-08 17:21
professionalScott Dorman16-Jun-08 17:21 
JokeRe: p0wned Pin
Leslie Sanford16-Jun-08 20:42
Leslie Sanford16-Jun-08 20:42 
QuestionFirst post !!! Pin
Christian Graus16-Jun-08 15:01
protectorChristian Graus16-Jun-08 15:01 
AnswerRe: First post !!! Pin
Scott Dorman16-Jun-08 17:20
professionalScott Dorman16-Jun-08 17:20 
AnswerRe: First post !!! Pin
Harvey Saayman17-Jun-08 1:19
Harvey Saayman17-Jun-08 1:19 
GeneralRe: First post !!! Pin
Paul Coldrey7-Oct-08 15:16
professionalPaul Coldrey7-Oct-08 15:16 
QuestionSQL Injection Prevention - How Good Are These Measures? Pin
nalorin11-Jun-08 7:55
nalorin11-Jun-08 7:55 
AnswerRe: SQL Injection Prevention - How Good Are These Measures? Pin
Bradml11-Jun-08 21:36
Bradml11-Jun-08 21:36 
GeneralRe: SQL Injection Prevention - How Good Are These Measures? Pin
Mohammad Dayyan11-Jun-08 22:57
Mohammad Dayyan11-Jun-08 22:57 
GeneralRe: SQL Injection Prevention - How Good Are These Measures? Pin
Chris Maunder12-Jun-08 0:20
cofounderChris Maunder12-Jun-08 0:20 
GeneralRe: SQL Injection Prevention - How Good Are These Measures? Pin
Bradml12-Jun-08 0:58
Bradml12-Jun-08 0:58 
GeneralRe: SQL Injection Prevention - How Good Are These Measures? Pin
Hesham Amin13-Jun-08 0:09
Hesham Amin13-Jun-08 0:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.