ainsleyclark
-
Posts
3 -
Joined
-
Last visited
Never
Posts posted by ainsleyclark
-
-
[!--quoteo(post=372909:date=May 10 2006, 01:57 PM:name=448191)--][div class=\'quotetop\']QUOTE(448191 @ May 10 2006, 01:57 PM) [snapback]372909[/snapback][/div][div class=\'quotemain\'][!--quotec--]
What exactly "doesn't work"? Do you get any error messages?
[/quote]
everything works, well i think as u think there are error messages in it?
i was this save button to update the table in my php document,
is this doing it? im really confused [img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /] what do i nee for a content manganment system? -
hello everybody. i have made a login for usernames and passwords and it redirects them to their profile, i want the user to be able to edit their profile by using a save button then link that back to a table in my original document. here is the script that i got of a site but im still stuck on how to do it! please help me im only a rookie!
PHP Code:
<?php
if(isset($_POST['save']))
{
$id = $_SESSION['userid'];
$customers_firstname = $_POST['customers_firstname'];
$customers_lastname = $_POST['customers_lastname'];
$customers_email = $_POST['customers_email'];
$customers_email = $_POST['customers_email'];
$customers_street_address = $_POST['customers_street_address'];
$customers_city = $_POST['customers_city'];
$customers_postcode = $_POST['customers_postcode'];
$customers_state = $_POST['customers_state'];
$customers_country = $_POST['customers_country'];
$customers_phone = $_POST['customers_phone'];
$customers_email_address = $_POST['customers_email_address'];
$customers_phone2 = $_POST['customers_phone2'];
$customers_username = $_POST['customers_username'];
$account_created = $_POST['customers_date_account_created'];
$now = date("Y-m-d H:i:s");
$update_customer = ("UPDATE $customer_table SET customers_firstname = '$customers_firstname',
customers_lastname = '$customers_lastname', customers_email = '$customers_email',
customers_street_address = '$customers_street_address', customers_city = '$customers_city',
customers_postcode = '$customers_postcode', customers_state = '$customers_state',
customers_country = '$customers_country', customers_phone = '$customers_phone',
customers_phone2 = '$customers_phone2', customers_username = '$customers_username',
customers_date_account_last_modified = '$now', customers_date_account_created = '$account_created'
WHERE customers_id = '$id'");
$update_query = mysql_query($update_customer) or die(mysql_error());
if(!$update_query)
{
echo 'Error in updating customer contact information!';
}
else
{
echo 'Customer contact information successfully updated!';
}
}
else
{
$id = $_SESSION['userid'];
$order_details = mysql_query("SELECT * FROM customers WHERE customers_id= '$id' ");
while ($line = mysql_fetch_array($order_details)) {
$customers_id = $line["customers_id"];
$customers_firstname = $line["customers_firstname"];
$customers_lastname = $line["customers_lastname"];
$customers_email = stripslashes($line["customers_email"]);
$customers_street_address = $line["customers_street_address"];
$customers_city = $line["customers_city"];
$customers_postcode = $line["customers_postcode"];
$customers_state = $line["customers_state"];
$customers_country = $line["customers_country"];
$customers_phone = $line["customers_phone"];
$customers_phone2 = $line["customers_phone2"];
$customers_username = $line["customers_username"];
$customers_ip = $line["customers_ip"];
//$customers_date_of_last_logon = date("m-d-Y h:i:s A", strtotime($line['customers_date_of_last_logon']));
$customers_number_of_logons = $line["customers_number_of_logons"];
$customers_date_account_created = date("m-d-Y h:i:s A", strtotime($line['customers_date_account_created']));
$customers_date_account_last_modified = date("m-d-Y h:i:s A", strtotime($line['customers_date_account_last_modified']));
echo'';
}
?>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" name="customer_details" id="customer_details">
<table width="50%" border="0" align="center" class="newsheader">
<caption>
Customer Details for ID <strong><?=$customers_id ?></strong>
</caption>
<tr>
<td width="21%"><div align="right">First Name:</div></td>
<td width="40%"><input name="customers_firstname" type="text" id="customers_firstname" value="<?=$customers_firstname ?>"></td>
<td width="21%"><div align="right">E-Mail:</div></td>
<td width="40%"><input name="customers_email" type="text" id="customers_email" value="<?=$customers_email ?>"></td>
</tr>
<tr>
<td><div align="right">Last Name: </div></td>
<td><input name="customers_lastname" type="text" id="customers_lastname" value="<?=$customers_lastname ?>"></td>
<td><div align="right">User Name: </div></td>
<td><input name="customers_username" type="text" id="customers_username" value="<?=$customers_username ?>"></td>
</tr>
<tr>
<td><div align="right">Street:</div></td>
<td><input name="customers_street_address" type="text" id="customers_street_address" value="<?=$customers_street_address ?>"></td>
<td><div align="right">City:</div></td>
<td><input name="customers_city" type="text" id="customers_city" value="<?=$customers_city ?>"></td>
</tr>
<tr>
<td><div align="right">State:</div></td>
<td><input name="customers_state" type="text" id="customers_state" value="<?=$customers_state ?>"></td>
<td><div align="right">Zip:</div></td>
<td><input name="customers_postcode" type="text" id="customers_postcode" value="<?=$customers_postcode ?>"></td>
</tr>
<tr>
<td><div align="right">Phone:</div></td>
<td><input name="customers_phone" type="text" id="customers_phone" value="<?=$customers_phone ?>"></td>
<td><div align="right">Mobile:</div></td>
<td><input name="customers_phone2" type="text" id="customers_phone2" value="<?=$customers_phone2 ?>"></td>
</tr>
<tr>
<td><div align="right">IP:</div></td>
<td><?=$customers_ip ?></td>
<td><div align="right">Last Login: </div></td>
<td><?=$customers_date_of_last_logon ?></td>
</tr>
<tr>
<td><div align="right">Created:</div></td>
<td><input name="customers_date_account_created" type="text" id="customers_date_account_created" value="<?=$customers_date_account_created ?>"></td>
<td><div align="right">Modified:</div></td>
<td><?=$customers_date_account_last_modified ?></td>
</tr>
<tr>
<td colspan="4"><div align="center">
<input name="save" type="submit" id="save" value="Save">
</div></td>
</tr>
</table>
</form>
<?
}
?>
News posting
in PHP Coding Help
Posted