basic-php-12-update-account.php / php
<?php include "auth_user.inc.php"; include "conn.inc.php"; ?> <html> <head> <title>Beginning PHP5, Apache and MySQL</title> </head> <body> <h1>Update Account Information</h1> <p> Here you can update your account information for viewing in your profile.<br><br> <?php if (isset(_POST['submit'] == "Update") { _POST['email'] . "', " . "city = '" . _POST['state'] . "', " . "hobbies = '" . implode(", ",_SESSION['user_logged'] . "' AND password = (PASSWORD('" . result_update = mysql_query(query = "SELECT * FROM user_info " . "WHERE username = '" . _SESSION['user_password'] . "'))"; query) or die(mysql_error()); result); row['hobbies']) ?> <b>Your account information has been updated.</b><br> <a href="user_personal.php">Click here</a> to return to your account. <form action="update_account.php" method="post"> Email: <input type="text" name="email" value="<?php echo <br> City: <input type="text" name="city" value="<?php echo row['city']; ?>"><br> State: <input type="text" name="state" value="<?php echo <br> Hobbies/Interests: (choose at least one)<br> <select name="hobbies[]" size="10" multiple> <option value="Golfing"<?php if (in_array("Golfing", hobbies)) { echo " selected"; } ?>>Golfing</option> <option value="Hunting"<?php if (in_array("Hunting", </option> <option value="Reading"<?php if (in_array("Reading", hobbies)) { echo " selected"; } ?>>Reading</option> <option value="Dancing"<?php if (in_array("Dancing", </option> <option value="Internet"<?php if (in_array("Internet", hobbies)) { echo " selected"; } ?>>Internet</option> <option value="Flying"<?php if (in_array("Flying", </option> <option value="Traveling"<?php if (in_array("Traveling", hobbies)) { echo " selected"; } ?>>Traveling</option> <option value="Exercising"<?php if (in_array("Exercising", </option> <option value="Computers"<?php if (in_array("Computers", hobbies)) { echo " selected"; } ?>>Computers</option> <option value="Other Than Listed"<?php if (in_array("Other Than Listed", </option> </select><br><br> <input type="submit" name="submit" value="Update"> <input type="button" value="Cancel" onclick="history.go(-1);"> </form> </p> <?php } else { query = "SELECT * FROM user_info " . "WHERE username = '" . _SESSION['user_password'] . "'));"; query) or die(mysql_error()); result); row['hobbies']) ?> <p> <form action="update_account.php" method="post"> Email: <input type="text" name="email" value="<?php echo <br> City: <input type="text" name="city" value="<?php echo row['city']; ?>"><br> State: <input type="text" name="state" value="<?php echo <br> Hobbies/Interests: (choose at least one)<br> <select name="hobbies[]" size="10" multiple> <option value="Golfing"<?php if (in_array("Golfing", hobbies)) { echo " selected"; } ?>>Golfing</option> <option value="Hunting"<?php if (in_array("Hunting", </option> <option value="Reading"<?php if (in_array("Reading", hobbies)) { echo " selected"; } ?>>Reading</option> <option value="Dancing"<?php if (in_array("Dancing", </option> <option value="Internet"<?php if (in_array("Internet", hobbies)) { echo " selected"; } ?>>Internet</option> <option value="Flying"<?php if (in_array("Flying", </option> <option value="Traveling"<?php if (in_array("Traveling", hobbies)) { echo " selected"; } ?>>Traveling</option> <option value="Exercising"<?php if (in_array("Exercising", </option> <option value="Computers"<?php if (in_array("Computers", hobbies)) { echo " selected"; } ?>>Computers</option> <option value="Other Than Listed"<?php if (in_array("Other Than Listed", </option> </select><br><br> <input type="submit" name="submit" value="Update"> <input type="button" value="Cancel" onclick="history.go(-1);"> </form> </p> <?php } ?> </body> </html>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.