Hi there trying to do a form and I want it so the user is filling out a crime report style sheet, the info is then put from there into an SQL data base but on top of that I'd like it to return, like a search function with possible suspects?
I keep having issues with my PHP coding and I've tried that many different things nothing seems to be working.
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$prettypls = mysql_connect("localhost", "root", "usbw");
$prettyplsdb = mysql_select_db("prettypls");
if (!$prettypls) {
die ('couldnae dae it: ' . mysql_error());
}
echo 'connection worked';
if (isset($_POST['theft'])) {
}
if (isset($_POST['murder'])) {
}
if (isset($_POST['arson'])) {
}
if (isset($_POST['rape'])) {
}
if (isset($_POST['violence'])) {
}
if (isset($_POST['tb'])) {
}
if (isset($_POST['van'])) {
}
if (isset($_POST['graf'])) {
}
if (isset($_POST['other'])) {
}
if (isset($_POST['crime'])) {
}
if (isset($_POST['tidy'])) {
}
if (isset($_POST['messy'])) {
}
if (isset($_POST['mirrors'])) {
}
if (isset($_POST['u1'])) {
}
if (isset($_POST['u2'])) {
}
if (isset($_POST['f1'])) {
}
if (isset($_POST['f2'])) {
}
if (isset($_POST['tap'])) {
}
if (isset($_POST['item'])) {
}
if (isset($_POST['item1'])) {
}
mysql_query("INSERT INTO crime ('theft', 'murder', 'arson', 'rape', 'violence', 'tb', 'van', 'graf', 'other', 'crime') VALUES ('" . $_POST['theft'] . "', '" . $_POST['murder'] . "', '" . $_POST['arson'] . "', '" . $_POST['rape'] . "', '" . $_POST['violence'] . "', '" . $_POST['tb'] . "', '" . $_POST['van'] . "', '" . $_POST['graf'] . "', '" . $_POST['other'] . "', '" . $_POST['crime'])") or die ("crime Not Inserted");
mysql_query("INSERT INTO trait ('tidy', 'messy', 'mirrors', 'u1', 'u2', 'f1', 'f2', 'tap', 'item', 'item1') VALUES ('" . "', '" . $_POST['tidy] . "', '" . $_POST['messy'] . "', '" . $_POST['mirrors'] . "', '" . $_POST['u1'] . "', '" . $_POST['u2'] . "', '" . $_POST['f1'] . "', '" . $_POST['f2'] . "', '" . $_POST['tap'] . "', '" . $_POST['item'] . "', '" . $_POST['item1'])") or die ("Trait not insterted");
?>
</body>
</html>
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="prettypls.php">
<p>
<label>You have selected Break In, are there - if any - other crimes alongside it? Please select all that apply.<br />
</label><br />
<input type="checkbox" name="theft" value="Theft" /> Theft
<input type="checkbox" name="murder" value="Murder" />
Murder
<input type="checkbox" name="arson" value="Arson"/>
Arson
<input type="checkbox" name="rape" value="Rape" />
Rape </p>
<p>
<input type="checkbox" name="violence" value="Violence" /> Violence
<input type="checkbox" name="tb" value="Threatening Behavior" />
Threatening Behavior
<input type="checkbox" name="van" value="Vandalism" />
Vandalism
<input type="checkbox" name="graf" value="Graffiti" />
Graffiti</p>
<p>
<input type="checkbox" name="other" value="Other" />
Other - If other, specify in box below</p>
<p>
<textarea name="crime" wrap="off"></textarea>
</p></form>
<p>How was the crime scene?</p>
<form id="form2" name="form2" method="post" action="prettypls.php">
<p> </p>
<p>
<input type="checkbox" name="tidy" value="tidy" />
Premises was tidy
<input type="checkbox" name="messy" value="trashed" />
Premises were trashed
<input type="checkbox" name="mirrors" value="mirrors" />
Mirrors were smashed</p>
<p>
<input type="checkbox" name="u1" value="Urination1" />
Criminal(s) urinated in the open premises
<input type="checkbox" name="u2" value="Urination2" />
Criminal(s) urinated in the premises toilets</p>
<p>
<input type="checkbox" name="f1" value="Feces1" />
Criminal(s) created fecel matter in the open premises</p>
<p>
<input type="checkbox" name="f2" value="Feces2" />
Criminal(s) created fecel matter in the premises toilets</p>
<p>
<input type="checkbox" name="tap" value="Tap" />
Criminal(s) left tap(s) running </p>
<p>
<input type="checkbox" name="item" value="Item" />
Criminal(s) left signature item - please specify in the box below</p>
<p>
<textarea name="item1" wrap="off"></textarea> </p>
<p>
<input type="submit" name="crime2" value="Submit" />
<input type="reset" name="crime" value="Reset" />
</p>
</form>
</body>
</html>
Is it possible to have it so it writes different parts of the form to different databases? If so, how... Thanks!