Hey allemaal. Ik ben recent begonnen met PHP en had een zeer simpele uitwerking gemaakt voor de validatie van een veld in mijn formulier. Aleen hij "triggered" niet en ik weet neit waar dit aan ligt. In asp zo ik kunnen debuggen maar met PHP heb ik geen idee hoe ik dit kan terug vinden aangezien er geen foutmelding is. deze pagina stuurt zichzelf terug de naam is dus "add_contact.php"
hier volgt mijn code.
<?php
require 'authenticate.php';
require 'includes/title.php';
?>
<?
$message = "";
if ($_POST['process'] == 1)
{
if ( empty($_POST['companyname']) )
{
$message += "You have to fill in a company name";
}
}
?>
<!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=iso-8859-1" />
<meta http-equiv="Content-Language" content="nl, dutch, nederlands" />
<meta name="author" content="Contact Manager, Rodney Wormsbecher, [email protected], [email protected]" />
<meta name="keywords" content="Contact Manager" />
<meta name="copyright" content="Contact Manager C 2007" />
<meta name="description" content="Access your address book from anywhere in the world through the web" />
<title><?php echo $currentpage; ?></title>
<link href="CSS/mainLayout.css" rel="stylesheet" type="text/css" />
<link href="CSS/menu.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container" class="minwidth">
<div id="headerWrapper">
<h1>Contact manager, access your address book anywhere in the world.</h1>
<div id="leftBorder">
</div>
<div id="headerContent">
<h2>Contact manager</h2>
<p>access your address book anywhere in the world.</p>
</div>
<div id="rightBorder">
</div>
<!-- end of headerWrapper -->
</div>
<div id="navMenu">
<div id="navMenuCenter" class="minwidthNav">
<ul>
<li><a id="viewContactsLink" href="view_contacts.php"></a></li>
<li><a id="addContactLink" href="add_contact.php"></a></li>
<li><a id="searchContactLink" href="search_contact.php"></a></li>
<?php
if ($_SESSION['securitylevel'] > 1)
{
echo "<li><a id='deleteContactLink' href='delete_contact.php'></a></li>";
}
if ($_SESSION['securitylevel'] > 2)
{
echo "<li><a id='addUserLink' href='add_user.php'></a></li>";
}
if ($_SESSION['securitylevel'] > 3)
{
echo "<li><a id='removeUserLink' href='remove_user.php'></a></li>";
}
?>
</ul>
</div>
<!-- end of navMenu -->
</div>
<!-- end of container -->
</div>
<div id="contentArea" class="minwidthContentArea">
<div id="leftMenu">
<div id="leftMenuTop">
</div>
<div id="leftMenuContent">
<ul>
<li><a href="add_contact.php">Add a company</a></li>
<li><a href="add_contact_person.php">Add a contact person</a></li>
</ul>
</div>
<div id="leftMenuBottom">
</div>
<!-- end of leftmenu -->
</div>
<div id="contentWrapper">
<div id="contentTopBorder">
</div>
<div id="contentContent">
<p>
On this page you can add a company to the database. Please note that all the fields
with an <em>*</em> behind it are obligated. When creating a new user please provide
as many details as possible.
</p><br /><br />
<form action="add_contact.php" method="post">
<?php
if ($message != "")
{
print "<span>" . $message . "</span><br />\n";
}
?>
<table border="0" cellspacing="8" cellpadding="2">
<tr>
<td colspan="2"><b>Company Information:</b></td>
<td width="40"></td>
<td colspan="2"><b>Postal Information:</b></td>
</tr>
<tr>
<td width="130"><label for="companyname" />Company name: <em>*</em></td>
<td width="130"><input type="text" name="companyname" maxlength="75" size="15" /></td>
<td width="40"></td>
<td width="130"><label for="postalstreet" />street name: </td>
<td width="130"><input type="text" name="postalstreet" maxlength="75" size="15" /></td>
</tr>
<tr>
<td width="130"><label for="companystreetname" />street name: <em>*</em></td>
<td width="130"><input type="text" name="companystreetname" maxlength="75" size="15" /></td>
<td width="40"></td>
<td width="130"><label for="postalstreet" />house number + extension: </td>
<td width="130"><input type="text" name="postalhousenumber" maxlength="8" size="5" />
<input type="text" name="postalhousenumberextension" maxlength="20" size="5" />
</td>
</tr>
<tr>
<td width="130"><label for="companyhousenumber" />house number + extension: <em>*</em></td>
<td width="130"><input type="text" name="companyhousenumber" maxlength="8" size="5" />
<input type="text" name="companyhousenumberextension" maxlength="20" size="5" />
</td>
<td width="40"></td>
<td width="130"><label for="postalzip" />ZIP: </td>
<td width="130"><input type="text" name="postalzip" maxlength="15" size="15" /></td>
</tr>
<tr>
<td width="130"><label for="companyzip" />ZIP: <em>*</em></td>
<td width="130"><input type="text" name="companyzip" maxlength="15" size="15" /></td>
<td width="40"></td>
<td width="130"><label for="postalcity" />city:</td>
<td width="130"><input type="text" name="postalcity" maxlength="60" size="15" /></td>
</tr>
<tr>
<td width="130"><label for="companycity" />City: <em>*</em></td>
<td width="130"><input type="text" name="companycity" maxlength="60" size="15" /></td>
<td width="40"></td>
<td width="130"><label for="postalstate" />state:</td>
<td width="130"><input type="text" name="postalstate" maxlength="60" size="15" /></td>
</tr>
<tr>
<td width="130"><label for="companystate" />State: <em>*</em></td>
<td width="130"><input type="text" name="companystate" maxlength="60" size="15" /></td>
<td width="40"></td>
<td width="130"><label for="postalcountry" />country:</td>
<td width="130"><input type="text" name="postalcountry" maxlength="60" size="15" /></td>
</tr>
<tr>
<td width="130"><label for="companycountry" />Country: <em>*</em></td>
<td width="130"><input type="text" name="companycountry" maxlength="60" size="15" /></td>
<td width="40"></td>
<td width="130"></td>
<td width="130"></td>
</tr>
<tr>
<td width="130"></td>
<td width="130"></td>
<td width="40"></td>
<td width="130"></td>
<td width="130"></td>
</tr>
<tr>
<td width="130"></td>
<td width="130"></td>
<td width="40"></td>
<td width="130"><input type="hidden" name="process" value="1" /></td>
<td width="130"><input type="submit" value="Save Company" /></td>
</tr>
</table>
</form>
</div>
<div id="contentBottomBorder">
</div>
<div id="Copyright">
copyright © Rodney Wormsbecher <?php echo Date('Y'); ?>
</div>
<!-- end of contentwrapper -->
</div>
<!-- end of content area -->
</div>
</body>
</html>
als iemand mij zou kunnen helpen zou dan heel erg gewaardeerd worden :)
799 views