Mysqlphphelp |
11-28-2011 09:10 AM |
Something not working?
Quote:
Originally Posted by Mysqlphphelp
(Post 4535422)
Yes this method is post. Here is the form code
Could sme users not be able to post because of the tables? Some users are able to post and some not. I really appreciate all the help I can get:) Thank you so much:)
|
http://www.pesttrackers.com/addresspost_insert_form.phpCan you give me any reasons why it would not be functioning for some and not for others?
Here the is code for inserting the info to the db
Quote:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="google-site-verification" content="mkjty4aSt_VRymPziZ2b-tLabl3EbTPxS8o7l99VH3I" />
<title>Cockroach Bed Bug Mice Rat Pest Registry</title>
</head>
<body>
<?php
/* Change db and connect values if using online */
$name=$_POST['name'];
$address=$_POST['address'];
$lat=$_POST['lat'];
$lng=$_POST['lng'];
$email=$_POST['email'];
$message=$_POST['message'];
$postalcode=$_POST['postalcode'];
?>
<?php
require("mysql_connect.php");
// escape username and password for use in SQL
$name = mysql_real_escape_string($name);
$message = mysql_real_escape_string($message);
$sql = "SELECT * FROM markers WHERE
name='" . $name . "' AND message='" . $message . "'";
$conn = mysql_connect($dbhost, $dbusername,$dbpass,$dbname);
mysql_select_db($dbname);
if (! $conn)
die(mysql_error());
mysql_select_db($dbname , $conn) or die("Select Error: ".mysql_error());
mysql_query($sql);
$query = sprintf("SELECT * FROM markers WHERE name='%s' AND message='%s'",
mysql_real_escape_string($name),
mysql_real_escape_string($message));
$result=mysql_query("INSERT INTO markers (name, address, lat, lng, email, message, postalcode) VALUES (
'$name',
'$address',
'$lat',
'$lng',
'$email',
'$message',
'$postalcode')") or die("Insert Error: ".mysql_error());
mysql_close($conn);
?>
<br>
<DIV style="width:800px; border-style:double" align="center">
<p align="center">Thank you for your posting</p>
<p><h3 align="center">Here is your message: </h3></p>
<p> <p> </p>
<?php
require("mysql_connect.php");
$conn = mysql_connect($dbhost, $dbusername,$dbpass,$dbname);
mysql_select_db($dbname);
if (! $conn)
die(mysql_error());
mysql_select_db($dbname , $conn) or die("Select Error: ".mysql_error());
$result = mysql_query("SELECT message, address, postalcode FROM markers ORDER BY ID DESC LIMIT 1");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf("<b>Message:</b><br/><br/> %s <br/><br/><br/><b>Address:</b><br/> <br/>%s<br/><br/><b>Postal Code/Zip Code:</b><br/><b><br/>%s<br/>", $row[0], $row[1], $row[2],$row[3]);
}
mysql_free_result($result);
mysql_close($conn);
?>
</p>
<p> </p>
<p> </p>
</div>
<p> </p>
</body>
</html>
|
Here is the form code. Could you please tell me if the syntax and the doctype are making this not work for some but work for others? Could you please give me some insight as to my errors. I appreciate your time and hope I can get some answers as to the errors I may have in the two files, maybe that is why some can use and some cannot? Please help I will do anything to know what is happening:(
Quote:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="google-site-verification" content="mkjty4aSt_VRymPziZ2b-tLabl3EbTPxS8o7l99VH3I" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pest Detective Tracking Record</title>
<style type="text/css">
td {
font-family: tahoma, arial, verdana;
font-size: 10pt;
border: thick groove #C93;
}
</style>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script type="text/javascript">
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
} }
</script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h3 align="center"> </h3>
<DIV style="width:800px; border-style:double" align="center">
<form method="post" action="addresspost_insert_record.php">
<p align="center"> </p>
<p align="center">Pest Detective Record</p>
<p align="center">ATTEN: PLEASE READ BEFORE POSTING*</p>
<p align="center"><strong>If your form is submitted and you cannot see your post or get a specific error<br/>
please contact us: <a href="mailto:support@pesttrackers.com">support@pesttrackers.com</a></strong></p>
<p align="center"><strong><dfn>Please let us know as we are counting on you to help get Pest Trackers started</dfn></strong></p>
<p align="center"> </p>
<p align="center"><b>Name Your Pest:</b></p>
<p align="center"><span id="sprytextfield1">
<input name="name" type="text" id="name" onDblClick="MM_validateForm('name','','R','message','','R');return document.MM_returnValue" size="20" maxlength="40">
<span class="textfieldRequiredMsg">A pest is required.</span></span></p>
<p align="center"><br />
<b> Address:</b> Ex. Street Number, Street Name, City Province/State <span id="sprytextfield4">
<input name="address" type="text" size="40
" maxlength="50" />
<span class="textfieldRequiredMsg">Address is required.</span></span> </p>
<div align="center">If you have seen a pest outside and not at a physical address please post the area: <br />
Park name City Province/State
</div>
<p align="center"><b>Postal Code / Zip Code:</b><span id="sprytextfield3">
<input type="text" size="15" maxlength="10" name="postalcode" />
<span class="textfieldRequiredMsg">A postal code/zip code is required.</span></span></p>
<p align="center"><b>Email:</b> <br/>(will not be shared with anyone, we need it if we have to confirm anything <br/>in your post with you) Be assured Pest Trackers will keep your email secure.<br/><br/>
<span id="sprytextfield2">
<input type="text" size="50" maxlength="50" name="email" />
<span class="textfieldRequiredMsg">A email is required.</span><span class="textfieldInvalidFormatMsg">Invalid Email Address.</span></span></p>
<p align="center"><b>Message:</b> (No offensive language, get more action with just the facts!)<br/>Please include the following in your post: What pest you are having<br/>
issues with and the date you discovered them.</p>
<p align="center"><br/>
<br/>
<textarea name="message" cols="60" rows="30" id="message" onDblClick="MM_validateForm('name','','R','message','','R');return document.MM_returnValue">Please use no offensive language, get more action with just the facts!
Please include the following in your post:
What pest you are having issues with and the date you discovered them.</textarea>
<p align="center"> </p>
<p>
<input type="submit" value="Send"/>
</p>
<p> If you do not see your post one or more fields or missing </p>
</form>
<div align="center">
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "email");
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {validateOn:["change"]});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4");
</script>
</div>
</div>
</body>
</html>
|
|