Forum Moderators: coopster
Any suggestions?
Matt
Here is the code I have written:
<?php
// Get Client NAME
$firstname = $_COOKIE['fname'];
$lastname = $_COOKIE['lname'];
// Get info from pdf post
$Participant_Street = $_POST['Participant_Street'];
echo "Participant Street: '$Participant_Street'" ;
// Connect to mySQL
$conn = @mysql_connect("localhost", "user", "password")
or die("Could not connect to MySQL");
$db = @mysql_select_db("my_database", $conn)
or die("Could not select database");
// Insert Data for Client
$sql = "UPDATE clients SET Participant_Street = '$Participant_Street' WHERE fname = '$firstname' and lname = '$lastname'";
$result = @mysql_query( $sql, $conn)
or die("Could not execute query");
if($result) {echo("Information: $Participant_Street saved");}
?>
If I fill out my pdf with some information (say 691 in the "Participant Street" field) I get the following displayed:
Participant Street: '691'Information: 691 saved
Just as I would expect if it worked properly. No errors.
[edited by: ergophobe at 8:35 pm (utc) on Aug. 11, 2005]
[edit reason] Anonymized user and password (hacker alert) [/edit]
When I echoed my sql query I got:
UPDATE clients SET Participant_Street = '691' WHERE fname = '' and lname = ''
Here is my current code:
<?php // Get Client NAME
$firstname = $_COOKIE['fname'];
$lastname = $_COOKIE['lname'];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<?php
// Get info from pdf post
$Participant_Street = $_POST['Participant_Street'];
echo ("Participant Street: $Participant_Street") ;
// Connect to mySQL
$conn = @mysql_connect("localhost", "user", "password")
or die("Could not connect to MySQL");
$db = @mysql_select_db("my_database", $conn)
or die("Could not select database");
// Insert Data for Client
$sql = "UPDATE clients SET Participant_Street = '$Participant_Street' WHERE fname = '$firstname' and lname = '$lastname'";
$result = @mysql_query( $sql, $conn)
or die("Could not execute query");
if($result) {echo("Information: $Participant_Street saved $sql");}
?>
</body>
</html>
[edited by: ergophobe at 1:01 am (utc) on Aug. 12, 2005]
[edit reason] Anonymized user and password (hacker alert) [/edit]
To turn error_reporting on you can simply add the function to the top of your script during development (don't forget to remove it before putting it into production though).
<?php
error_reporting [php.net](E_ALL);
?>
Have you read through some of the common COOKIE pitfalls [php.net]?