Hello,
I'm trying to add some records to a database but it's not working and I don't why..
Can somebody check the code, please?
Thanks!
I'm trying to add some records to a database but it's not working and I don't why..
Can somebody check the code, please?
PHP:
<?php
//Mostra o fromulrio
if (isset($_POST['continue'])){
// Caso contrario processa o form
// variaveis
$fname = mysql_escape_string($_POST['fname']);
$lname = mysql_escape_string($_POST['lname']);
$mail = mysql_escape_string($_POST['mail']);
$logoname = mysql_escape_string($_POST['logoname']);
$slogan = mysql_escape_string($_POST['slogan']);
$description = mysql_escape_string($_POST['descri']);
$website = mysql_escape_string($_POST['website']);
$other = mysql_escape_string($_POST['other']);
include("db.php");
// open connection
$connection = mysql_connect($host, $user, $pass) or die ("No connection!");
// select database
mysql_select_db($db) or die ("No database?!");
// create query
$query = "INSERT INTO order (name, lastName, email) VALUES ('$fname', '$lname', '$mail')";
$result = mysql_query($query) or die ("There is a temporary problem with our service. Please try again later.");
$orderid = mysql_insert_id();
$query = "INSERT INTO projects (logoText, slogan, description, other, website, orderID) VALUES ('$logoname', '$slogan', '$description' ,'$other' ,'$website', '$orderid')";
$result = mysql_query($query) or die ("There is a temporary problem with our service. Please try again later.");
// close connection
mysql_close($connection);
}
else {
?>
<!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>
<title>
Wufoo ยท Example Form
</title>
<!-- Meta Tags -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- JavaScript -->
<script type="text/javascript" src="scripts/wufoo.js"></script>
<!-- CSS -->
<link rel="stylesheet" href="css/structure.css" type="text/css" />
<link rel="stylesheet" href="css/form.css" type="text/css" />
<link rel="stylesheet" href="css/theme.css" type="text/css" />
</head>
<body id="public">
<img id="top" src="images/top.png" alt="" />
<div id="container">
<form class="wufoo" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<ul>
<li class="section first">
<h3>Personal Information</h3>
<p>We want to know a little about you.</p>
</li>
<li>
<label class="desc">Name</label>
<span>
<input name="fname" class="field text" size="8" value=""/>
<label>First</label>
</span>
<span>
<input name="lname" class="field text" size="14" value=""/>
<label>Last</label>
</span> </li>
<li>
<label class="desc">E-mail</label>
<div class="address">
<div>
<input name="mail" class="field text full addr" type="text" value="" />
</div>
<p class="instruct">Instructions for the user. Robots are typically used to do the tasks that are too dirty,
dangerous, difficult, repetitive or dull for humans.<br /><br />Chris is Wufoo's robot.</p>
</div>
</li>
<li class="section">Your Logo
<p>Description of the logo.</p>
</li>
<li>
<label class="desc">Logo Name</label>
<div>
<input name="logoname" class="field text large" type="text" maxlength="255" value=""/>
</div>
</li>
<li>
<label class="desc">Slogan</label>
<div>
<input name="slogan" class="field text large" type="text" maxlength="255" value=""/>
</div>
</li>
<li>
<label class="desc">Description <span class="req">*</span></label>
<div>
<textarea name="descri" rows="10" cols="50" class="field textarea medium"></textarea>
</div>
<p class="instruct">Instructions for the user. Robots are typically used to do the tasks that are too dirty,
dangerous, difficult, repetitive or dull for humans.<br /><br />Chris is Wufoo's robot.</p>
</li>
<li>
<label class="desc">Web Site</label>
<div class="address">
<div>
<input name="website" class="field text full addr" type="text" maxlength="255" value="http://"/>
</div>
</div>
</li>
<li>
<label class="desc">Other <span class="req">*</span></label>
<div>
<textarea name="other" rows="10" cols="50" class="field textarea medium"></textarea>
</div>
<p class="instruct">Instructions for the user. Robots are typically used to do the tasks that are too dirty,
dangerous, difficult, repetitive or dull for humans.<br /><br />Chris is Wufoo's robot.</p>
</li>
<li class="buttons">
<input id="saveForm" class="btTxt" type="submit" value="Continue" name="continue" />
</li>
</ul>
</form>
</div><!--container-->
<img id="bottom" src="images/bottom.png" alt="" />
<?php
}
?>
</body>
</html>
Thanks!






