<?php
/**************************************************************************
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
@Authors: Ryan Thompson(hide@address.com)
***************************************************************************/
include("./data.php");
$service['add_header'] = TRUE;
include("../config.inc.php");
include($here. "/class.contacts.php");
$ct = new contacts;
$user_id = $user->user_id;
if(isset($_POST['save_contact']))
{
if($ct->add($_POST))
{
$O->redirect('/contacts');
}
}
echo $layout->page_header;
echo $layout->service_header($ct->msg('service_name'), $ct->nav_buttons(), $ct->msg('add_contact'));
if($error->buffer)
{
echo $error->display();
}
?>
<form name="contact" action="<?php echo $_SERVER['PHP_SELF']?>" method="post" onSubmit="return verifyName(this)">
<table width="400" align="center" cellspacing="0">
<tr>
<td class="input_header">Title:</td>
<td id="dark">
<?php
$title = array("Mr.", "Mrs.", "Ms.", "Miss", "Dr.", "Prof.");
echo "<select name=\"title\">";
$i = 0;
while($i < count($title))
{
echo "<option value=\"$title[$i]\">$title[$i]</option>";
$i++;
}
echo "</select>";
?>
</td></tr>
<tr><td class="input_header">First name:</td>
<td id="dark"><input type="text" size="40" name="firstname"></td></tr>
<tr><td class="input_header">Last name:</td>
<td id="dark">
<input type="text" size="40" name="lastname"></td></tr>
<tr><td class="input_header">Birthday</td><td id="dark">
<select name="birthday_day">
<option value=''>---</option>
<?php
$i = 1;
while($i<=31)
{
echo "<option value=\"$i\"";
if($i == $view_day)
{
echo " selected=\"selected\"";
}
echo ">$i</option>\n";
$i++;
}
?>
</select>
<select name="birthday_month">
<option value=''>---</option>
<?php
$i = 1;
$med_months = explode(':', $lang->msgs['med_months']);
while($i<=count($med_months))
{
echo "<option value=\"$i\"";
if($i == $view_month)
{
echo " selected=\"selected\"";
}
echo ">". $med_months[$i] ."</option>\n";
$i++;
}
?>
</select>
<select name="birthday_year">
<option value=''>-------</option>
<?php
$i = 1900;
while($i <= date("Y"))
{
echo "<option value=\"$i\"";
if($i == $view_year)
{
echo " selected=\"selected\"";
}
echo ">$i</option>\n";
$i++;
}
?>
</select>
</td></tr>
<tr><td class="input_header">Phone Number:</td><td id="dark"><input type="text" size="20" name="phone"></td></tr>
<tr><td class="input_header">Fax Number:</td><td id="dark"><input type="text" size="20" name="fax"></td></tr>
<tr><td class="input_header">Cell Phone:</td><td id="dark"><input type="text" size="20" name="cell"></td></tr>
<tr><td class="input_header">Email Address:</td><td id="dark"><input type="text" size="40" name="email_address"></td></tr>
<tr><td class="input_header">Address:</td><td id="dark"><input type="text" size="40" name="address"></td></tr>
<tr><td class="input_header">Address 2:</td><td id="dark"><input type="text" size="40" name="address2"></td></tr>
<tr><td class="input_header">City:</td><td id="dark"><input type="text" size="40" name="city"></td></tr>
<tr><td class="input_header">Province/State:</td><td id="dark"><input type="text" size="40" name="province"></td></tr>
<tr><td class="input_header">Country:</td>
<td id="dark">
<select name="country">
<?php
$sql = "SELECT * FROM o_countries";
$db->query($sql);
while($db->fetch_results())
{
echo "<option value=\"". $db->record['c_id'] ."\">". $db->record['country'] ."</option>\n";
}
?>
</select>
</td></tr>
<tr><td class="input_header">Postal Code:</td><td id="dark"><input type="text" size="7" name="postal_code"></td></tr>
<tr><td class="input_header">Website:</td><td id="dark"><input type="text" size="40" name="website"></td></tr>
<tr><td class="input_header">Company:</td><td id="dark"><input type="text" name="company" size="40"></td></tr>
<tr><td class="input_header">Department:</td><td id="dark"><input type="text" name="department" size="40"></td></tr>
<tr><td id="dark">
<input type="submit" value="<?php echo $ct->msg('save_contact')?>" name="save_contact" class="button1">
</td><td id="dark">
</form>
<input type="submit" name="back" value="<?php echo $ct->msg('cancel')?>" name="back" onClick="window.location='index.php'" class="button1">
</td></tr>
</table>
<br>
</div>
<?php
echo $layout->create_footer();
?>