PHP - Php User Edit Not Updating All Fields?
when i submit it, the only field that updates is the email field.
UserEdit.php file <? /** * UserEdit.php * * This page is for users to edit their account information * such as their password, email address, etc. Their * usernames can not be edited. When changing their * password, they must first confirm their current password. * */ include("include/session.php"); ?> <html> <title>Edit Your Details</title> <link rel="stylesheet" type="text/css" href="../assets/css/styles.css" /> <link rel="stylesheet" type="text/css" href="../assets/css/forms.css" /> <link rel="stylesheet" type="text/css" href="../assets/css/layout.css" /> <link rel="stylesheet" type="text/css" href="../assets/css/style.css" /> <style> #form6 input{ margin:0; width:250px; border:1px solid #ddd; padding:3px 5px 3px 25px; } input{ font:100% Trebuchet MS, Arial, Helvetica, Sans-Serif; line-height:160%; color:#FFF; } #form6 input{background:#000; } </style> <body> <? /** * User has submitted form without errors and user's * account has been edited successfully. */ if(isset($_SESSION['useredit'])){ unset($_SESSION['useredit']); echo "<h1>User Account Edit Success!</h1>"; echo "<p><b>$session->username</b>, your account has been successfully updated. " ."<a href=\"index.php\">Main</a>.</p>"; } else{ ?> <? /** * If user is not logged in, then do not display anything. * If user is logged in, then display the form to edit * account information, with the current email address * already in the field. */ if($session->logged_in){ ?> <h2>User Account Edit : <? echo $session->firstname; ?></h2> <? if($form->num_errors > 0){ echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>"; } ?> <form id="form6" action="process.php" method="POST"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr> <td>Email:</td> <td><input type="text" name="email" maxlength="50" value=" <? if($form->value("email") == ""){ echo $session->userinfo['email']; }else{ echo $form->value("email"); } ?>"> </td> <td><? echo $form->error("email"); ?></td> </tr> <tr> <td>Phone:</td> <td><input type="text" name="tel" maxlength="50" value=" <? if($form->value("tel") == ""){ echo $session->userinfo['tel']; }else{ echo $form->value("tel"); } ?>"> </td> <td><? echo $form->error("tel"); ?></td> </tr> <tr> <td>Address:</td> <td> <input type="text" name="address" maxlength="50" value=" <? if($form->value("address") == ""){ echo $session->userinfo['address']; }else{ echo $form->value("address"); } ?>" style="height: 138px"> </td> <td><? echo $form->error("address"); ?></td> </tr> <tr> <td>Company:</td> <td><input type="text" name="company" maxlength="50" value=" <? if($form->value("company") == ""){ echo $session->userinfo['company']; }else{ echo $form->value("company"); } ?>"> </td> <td><? echo $form->error("company"); ?></td> </tr> <tr><td colspan="2" align="right"> <input type="hidden" name="subedit" value="1"> <input type="submit" value="Edit Account"></td></tr> <tr><td colspan="2" align="left"></td></tr> </table> </form> <? } } ?> </body> </html> sends to session.php /** * editAccount - Attempts to edit the user's account information * including the password, which it first makes sure is correct * if entered, if so and the new password is in the right * format, the change is made. All other fields are changed * automatically. */ function editAccount($subcurpass, $subnewpass, $subemail, $subtel, $subaddress, $subcompany){ global $database, $form; //The database and form object /* New password entered */ if($subnewpass){ /* Current Password error checking */ $field = "curpass"; //Use field name for current password if(!$subcurpass){ $form->setError($field, "* Current Password not entered"); } else{ /* Check if password too short or is not alphanumeric */ $subcurpass = stripslashes($subcurpass); if(strlen($subcurpass) < 4 || !eregi("^([0-9a-z])+$", ($subcurpass = trim($subcurpass)))){ $form->setError($field, "* Current Password incorrect"); } /* Password entered is incorrect */ if($database->confirmUserPass($this->username,md5($subcurpass)) != 0){ $form->setError($field, "* Current Password incorrect"); } } /* New Password error checking */ $field = "newpass"; //Use field name for new password /* Spruce up password and check length*/ $subpass = stripslashes($subnewpass); if(strlen($subnewpass) < 4){ $form->setError($field, "* New Password too short"); } /* Check if password is not alphanumeric */ else if(!eregi("^([0-9a-z])+$", ($subnewpass = trim($subnewpass)))){ $form->setError($field, "* New Password not alphanumeric"); } } /* Change password attempted */ else if($subcurpass){ /* New Password error reporting */ $field = "newpass"; //Use field name for new password $form->setError($field, "* New Password not entered"); } /* Email error checking */ $field = "email"; //Use field name for email if($subemail && strlen($subemail = trim($subemail)) > 0){ /* Check if valid email address */ $regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*" ."@[a-z0-9-]+(\.[a-z0-9-]{1,})*" ."\.([a-z]{2,}){1}$"; if(!eregi($regex,$subemail)){ $form->setError($field, "* Email invalid"); } $subemail = stripslashes($subemail); } /* Errors exist, have user correct them */ if($form->num_errors > 0){ return false; //Errors with form } /* Update password since there were no errors */ if($subcurpass && $subnewpass){ $database->updateUserField($this->username,"password",md5($subnewpass)); } /* Change Email */ if($subemail){ $database->updateUserField($this->username,"email",$subemail); } /* Change Email */ if($subtel){ $database->updateUserField($this->username,"tel",$subtel); } /* Change Email */ if($subaddress){ $database->updateUserField($this->username,"address",$subaddress); } /* Change Email */ if($subcompany){ $database->updateUserField($this->username,"company",$subcompany); } /* Success! */ return true; } sends to database.php /** * updateUserField - Updates a field, specified by the field * parameter, in the user's row of the database. */ function updateUserField($username, $field, $value){ $q = "UPDATE ".TBL_USERS." SET ".$field." = '$value' WHERE username = '$username'"; return mysql_query($q, $this->connection); } think thats all you should need? Similar TutorialsI have a page where "Events" which may be of interest to site visitors can be recorded. Among other info, an "Event" has a "from" date and a "to" date (to show that an event will run from October 29th to October 31st, for example). All event info is being written to the db, but the "from" and "to" dates are not. (In the db, "0000-00-00 00:00:00" is being entered in the "from" and "to" columns.) In the Events table, both event_date and event_end_date are of type datetime. Dates are entered into the form fields via a javascript datepicker and are in the format "24/09/2011". I'm using this code: Code: [Select] // Check for a Start Date: if (empty($_POST['from'])) { $errors[] = 'You forgot to enter a Start Date for the event.'; } else { $from = $_POST['from']; } // Check for an End Date: if (empty($_POST['to'])) { $errors[] = 'You forgot to enter an End Date for the event.'; } else { $to = $_POST['to']; } The db query is this: Code: [Select] if (empty($errors)) { // If everything's OK. // Insert the Event info in the database... // Make the query: $q = "INSERT INTO events (title, event_date, event_end_date, venue, ext_link, blurb) VALUES ('$title', '$from', '$to', '$venue', '$ext_link', '$blurb') "; $r = @mysqli_query ($dbc, $q); // Run the query. if ($r) { // If it ran OK. // Print a message: echo "<h2>Event info added!</h2> <h3>Your entry is now visible on the <a href='index.php'>Home Page</a>.</h3> <p><a href='logout.php'><strong>Log out</strong></a></p> " ; mysqli_close($dbc); include('inc/footer.php'); exit(); And the form is this: Code: [Select] <form id="form1" name="form1" method="post" action="add_event.php"> <label for="title">Title</label> <input type="text" name="title" id="title" value="<?php if (isset($_POST['title'])) echo $_POST['title']; ?>" /> <script> $(function() { var dates = $( "#from, #to" ).datepicker({ defaultDate: "", changeMonth: true, numberOfMonths: 1, onSelect: function( selectedDate ) { var option = this.id == "from" ? "minDate" : "maxDate", instance = $( this ).data( "datepicker" ), date = $.datepicker.parseDate( instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings ); dates.not( this ).datepicker( "option", option, date ); } }); }); </script> <label for="from" >*From</label> <input type="text" name="from" id="from" value="<?php if (isset($_POST['from'])) echo $_POST['from']; ?>" /> <label for="to" ">*To</label> <input type="text" name="to" id="to" value="<?php if (isset($_POST['to'])) echo $_POST['to']; ?>" /> <label for="venue">*Venue</label> <input type="text" name="venue" id="venue" value="<?php if (isset($_POST['venue'])) echo $_POST['venue']; ?>" /> <label for="blurb">*Description</label> <textarea name="blurb" id="blurb" value="<?php if (isset($_POST['blurb'])) echo $_POST['blurb']; ?>" rows="5" ></textarea> <label for="ext_link">External link (optional, entered like "www.example.com")</label> <input type="text" name="ext_link" id="ext_link" value="<?php if (isset($_POST['ext_link'])) echo $_POST['ext_link']; ?>" /> <input type="submit" name="submit" value="Insert Event Info" class="submit" /></p> <input type="hidden" name="submitted" value="TRUE" /> </form> Can anyone tell me why the dates aren't being recorded? Any help will be greatly appreciated. I have problem that only last text field is updated, how should I fix this? Here's the code <?php if(isset($_POST["update"])){ mysql_query("UPDATE categories SET name_category = '".$_POST['category']."' WHERE ID= ".$_POST['currentCat']." ") or die(mysql_error()); mysql_query("UPDATE podkategorije SET name_subcategory = '".$_POST['subcategory']."' WHERE id_subCat= ".$_POST['currentSubCat']." ") or die(mysql_error()); } ?> <form action="" method="post" > <?php //creating texfields from db $query = "SELECT k.ID, k.name_category, pk.name_subcategory, pk.id_subCat FROM `categories` AS k JOIN `subcategories` AS pk ON pk.id_mainCat = k.ID"; $result = mysql_query($query) or die(mysql_error()); $currentCat = false; while($row = mysql_fetch_array($result)) { //so it doesn't repeat itself if($currentCat != $row['ID']) { //display of main Categories ?> <ul> <li> <br/><input name="categories" type="text" value="<?php echo $row['name_category']; ?>" /> </li> </ul> <? $currentCat = $row['ID']; } //display subcategories ?> <input name="subcategories" type="text" value="<?php echo $row['name_category']; ?>" /><br/> <input type="hidden" name="currentCat" value="<?php echo $row['ID']; ?>" /> <input type="hidden" name="currentSubCat" value="<?php echo $row['id_subCat']; ?>" /> <? } ?> <br /> <input type="button" value="Back" onClick="history.go(-1);return true;"> <input type="submit" value="Update" name="update"/> </form> Here goes.
I am trying to retrieve info. from mySql database and update 3 textfields.
I also have 4 selects on the form that need populating during the running of the program. My problem is using console I can see the info - Customer name - but it does not appear in the text field. The onchange request in the DIV container seems to be where it fails. Here are the files I am using:
1. add_an_order.php
<html> <head> <title>Add an Order</title> <link href = "css/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="include/jquery-1.11.1.min.js"></script> </head> <body> <div id="header"><img src="images/logo.png" /></div> <div id="nav"> <div id="nav_wrapper"> <ul> <li><a href="index.php">Orders</a></li><li> <a href="customers.php">Customers</a></li><li> <a href="contacts.php">Contacts</a></li><li> <a href="batteries.php">Batteries</a></li><li> <a href="#">Queries</a> </li> </ul> </div> </div> <div id="main"> <?php echo '<h3 id="menOpt">Add an Order</h3><hr>'; // Check for a form submission. /* if ($_SERVER['REQUEST_METHOD'] == 'POST') { $errors = array(); $required_fields = array('customer_name', 'customer_address', 'city', 'telephone'); foreach ($required_fields as $fieldname) { if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname])) { $errors[] = strtoupper($fieldname); } } if (empty($errors)) { include ('include/dbconnect.php'); $name = mysqli_real_escape_string($con, trim(strip_tags($_POST['customer_name']))); $contact = mysqli_real_escape_string($con, trim(strip_tags($_POST['contact']))); $address = mysqli_real_escape_string($con, trim(strip_tags($_POST['customer_address']))); $city = mysqli_real_escape_string($con, trim(strip_tags($_POST['city']))); $telephone = mysqli_real_escape_string($con, trim(strip_tags($_POST['telephone']))); $telephone = preg_replace('/[^0-9]/', '', $telephone); if (isset($_POST['deepc'])) { $deepc = 1; } else { $deepc = 0; } if (isset($_POST['problemc'])) { $problemc = 1; } else { $problemc = 0; } $problem = mysqli_real_escape_string($con, trim(strip_tags($_POST['problem']))); if (isset($_POST['blacklist'])) { $blacklist = 1; } else { $blacklist = 0; } if (isset($_POST['pickup'])) { $pickup = 1; } else { $pickup = 0; } $query = "INSERT INTO customers ( customer_name, contact, customer_address, city, telephone, deep_cycle, problem_customer, problem, blacklist, pickup) VALUES ('$name', '$contact', '$address', '$city', '$telephone', $deepc, $problemc, '$problem', $blacklist, $pickup)"; $r = mysqli_query($con, $query); if (mysqli_affected_rows($con) == 1) { echo '<p class="success">Customer has been successfully added.</p>'; } else { $message = "Could not add customer."; $message .= "<br />" . mysqli_error($con); } mysqli_close($con); } else { // We have errors. $message = count($errors) . " error(s) on the form."; } } // End: if ($_SERVER['REQUEST_METHOD'] == 'POST'). */ // Leave PHP and display the form. ?> <?php if (!empty($message)) { echo '<p class="error">' . $message . '</p>'; } ?> <?php // Output list of fields that have errors. if (!empty($errors)) { echo '<p class="error">'; foreach ($errors as $error) { echo $error . '<br />'; } echo '</p>'; } ?> <div class="container"> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <fieldset> <label>Business: <span class="important"> *</span><select name="customer_name" id="customer_name" onchange="request_fill(this.value)" value="<?php if (isset($_POST['customer_name'])) echo $_POST['customer_name']; ?>" ></select></label> <label>Address: <input type="text" name="address" id="add_a" value="<?php if (isset($_POST['customer_address'])) echo $_POST['customer_address']; ?>" /></label> <label>City: <input type="text" name="city" id="city" value="<?php if (isset($_POST['city'])) echo $_POST['city']; ?>" /></label> <label>Phone: <input type="text" name="telephone" value="<?php if (isset($_POST['telephone'])) echo $_POST['telephone']; ?>" /></label> <label>Manufacturer: <span class="important"> *</span><select name="manufacturer" id="manufacturer" onchange="request_mod(this.value)" value="<?php if (isset($_POST['manufacturer'])) echo $_POST['manufacturer']; ?>" ></select></label> <label>Model: <span class="important"> *</span><select name="model" id="model" onchange="form_yr(this.value)" value="<?php if (isset($_POST['model'])) echo $_POST['model']; ?>" ></select></label> <label>Year: <span class="important"> *</span><select name="battery" id="bat_disp" value="<?php if (isset($_POST['battery'])) echo $_POST['year'] ?>" ></select></label> <label>Quantity: <span class="important"> *</span><input type="text" name="quantity" id="quantity" value="<?php if (isset($_POST['quantity'])) echo $_POST['quantity']; ?>" /></label> <label>Warranty ? <input type="checkbox" name="warranty" <?php if ($_POST['warranty']) echo " checked"; ?> /></label> <label>Exchange ? <input type="checkbox" name="exchange" <?php if ($_POST['exchange']) echo " checked"; ?> /></label> <input type="submit" name="submit" value="Add Order" /> or <a href="index.php">Cancel</a> </fieldset> </form> </div> <script type="text/javascript" src="include/functions.js"></script> <script> $(document).ready(function() { $('.container').hide(); $('.container').fadeIn(1000); request_cust(); request_man(); }); </script> <?php include ('include/footer.php'); 2. request_fill function request_fill() { var cust2 = 'customer'; var ad = document.getElementById("add_a"); var hr = new XMLHttpRequest(); hr.open("POST", "battery_parser.php", true); hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { var dataArray = hr.responseText; ad.innerHTML = dataArray[1]; } } hr.send("&cust2="+cust2); } 3. battery_parser.php <?php include_once("include/dbconnect.php"); if (isset($_POST['cust2'])) { $cust2 = $_POST['cust2']; $sql = "SELECT customer_address FROM customers WHERE customer_id = 2"; $query = mysqli_query($con, $sql); $dataString = ''; while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){ $add = $row["customer_address"]; $dataString = $add; } mysqli_close($con); echo $dataString; exit(); } else { exit(); } ?> I have the following PHP script to update two time/date fields in the database. When i run this the fields are not updated. Can anyone see where i m going wrong. <?php $con = mysql_connect("localhost","dbname","dbpassword"); if (!$con) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db("my_db", $con); mysql_query("UPDATE msm_content SET created = '2011-01-02 00:00:00', modified = '2011-01-01 00:00:00'"); echo 'Query Updated successfully'; mysql_close($con); ?> Your guidance is much appreciated. Hi, I recently implemented a code to display user profile information. Well, it displays the username and password fine, but the edit function doesn't seem to be working. I edit the information, click submit, get a success message but the username and password didn't change. myprofile.php Code: [Select] <?php session_start(); include('config.php'); $sql = mysql_query( "SELECT * FROM users WHERE id='".$_SESSION['id']."'" ); echo "<h2>Profile</h2> <form method='post' action='editprofile.php'> <table>"; $row = mysql_fetch_array($sql); echo "<tr><th>Name: </th><td>".$row['username']."</td></tr> <tr><th>Password: </th><td><input type='password' value='".$row['password']."' disabled='true' /></td></tr>"; echo "</table><br /> <input type='submit' value='edit profile' /> </form>"; ?> editprofile.php Code: [Select] <?php include('config.php'); if(isset($_POST['btnedit'])){ $username = $_POST['username']; $password = $_POST['password']; $sql = mysql_query( "UPDATE users SET username='".$username."', password='".$password."' WHERE id='".$_SESSION['id']."'" ); if($sql){ echo "<script>alert('profile updated');window.location='myprofile.php'</script>"; }else{ echo "<script>alert('updating profile failed!');</script>"; } } $sql = mysql_query( "SELECT * FROM users WHERE id='".$_SESSION['id']."'" ); $row = mysql_fetch_array($sql); echo "<h2>Edit profile</h2> <form method='post'> <table> <tr><th>registered:</th><td><input type='text' name='username' value='".$row['username']."'/></td></tr> <tr><th>password:</th><td><input type='password' name='password' value='".$row['password']."'/></td></tr> </table><br /> <input type='submit' name='btnedit' value='update' /> </form>"; ?> hi im new to php
im using a script that i found at the link below:
http://forums.devshe...sql-891201.html
It works fine but i have added a couple of fields to the database : telephone and mobile_telephone
Ive change the register.php to include these fields but im struggling with the edit_account
Could anyone help please
I added some code last night that updates the "last_activity" field in the "member" table whenever the "body_header.inc.php" script is called, which means that pretty much whenever the User navigates to a new page or submits a form this field is updated. (I use this to kep my "User Online Status" up-to-date.) Everything was working fine until I suddenly started getting a "Cannot modify header" error before bed. Here is ONE sequence causing this error... - I am logged out - I am on http://local.debbie/index.php - I click on the "Log In" link - I am taken to http://local.debbie/members/log_in.php - I log in - I get this error... Quote Warning: Cannot modify header information - headers already sent by (output started at /Users/user1/Documents/DEV/++htdocs/05_Debbie/index.php:22) in /Users/user1/Documents/DEV/++htdocs/05_Debbie/components/body_header.inc.php on line 48 Here is part of my main index.php script... <?php //Build Date: 2012-03-08 // Initialize a session. session_start(); // Access Constants. require_once('config/config.inc.php'); // Set current Script Name. $_SESSION['returnToPage'] = $_SERVER['SCRIPT_NAME']; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- ################## DEBBIE ##################### --> <!-- HTML Metadata --> <title>Double Dee, Inc.</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- Page Stylesheets --> <link type="text/css" rel="stylesheet" href="css/_main.css" /> <link type="text/css" rel="stylesheet" href="css/_layout.css" /> <link type="text/css" rel="stylesheet" href="css/top_menu.css" /> <link type="text/css" rel="stylesheet" href="css/components.css" /> </head> <body> <div id="pageWrapper" class="clearfix"> <div id="pageInner"> <!-- BODY HEADER --> <?php require_once('components/body_header.inc.php'); ?> <!-- LEFT COLUMN --> <div id="pageLeftCol"> Here is a snippet from my body_header.inc.php script... <?php //Build Date: 2012-03-08 // ************************ // Update Last Activity. * // ************************ if ((isset($_SESSION['loggedIn'])) && ($_SESSION['loggedIn'] == TRUE)){ // Initialize Session. // session_start(); // Access Constants. // require_once('../config/config.inc.php'); // Initialize variables. $loggedIn = TRUE; $memberID = (isset($_SESSION['memberID']) ? $_SESSION['memberID'] : ''); // ************************ // Update Member Record. * // ************************ // Connect to the database. require_once(WEB_ROOT . 'private/mysqli_connect.php'); // Build query. $q1 = "UPDATE member SET logged_in=?, last_activity=now() WHERE id=? LIMIT 1"; // Prepare statement. $stmt1 = mysqli_prepare($dbc, $q1); // Bind variables to query. mysqli_stmt_bind_param($stmt1, 'si', $loggedIn, $memberID); // Execute query. mysqli_stmt_execute($stmt1); // Verify Update. if (mysqli_stmt_affected_rows($stmt1)!==1){ // Update Failed. $_SESSION['resultsCode'] = 'MEMBER_UPDATE_FAILED_2126'; // Redirect to Display Outcome. header("Location: " . BASE_URL . "members/results.php"); // End script. exit(); }//End of UPDATE MEMBER RECORD // Close prepared statement. mysqli_stmt_close($stmt1); // Close the connection. mysqli_close($dbc); /* */ }//End of UPDATE LAST ACTIVITY /* // Determine Current Script. $page = basename($_SERVER['REQUEST_URI']); if ($page == '') { $page = "index.php"; } */ // Determine Script Name. $scriptName = $_SERVER['SCRIPT_NAME']; ?> <!-- PAGE HEADER --> <div id="pageHeader"> <!-- COMPANY BRANDING --> <h1 id="companyLogo"> <!-- Display Logo if "Images On" --> <a href="/index.php"> <!-- Image Replacement Technique --> <span></span> </a> <!-- Display Text if "Images Off" --> DoubleDee, Inc: Tips on starting a Small-Business </h1> <!-- WELCOME MESSAGE --> <?php $firstName = (isset($_SESSION['memberFirstName']) ? $_SESSION['memberFirstName'] : ''); I was mindful of extra white space possibly causing the issue, but I don't see where it is?! The "Update Last Activity" code was added to my Header last night and is likely the culprit... Any ideas what is wrong?? Thanks, Debbie Hi, I want to update user information in the database but it doesn't do anything. No data entered upon form submission. Please anyone if you can help would be great. Thank you. Code: [Select] <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); $host = "";//edited out $database = ""; $username = ""; $password = ""; $tbl_name = "users"; $link = mysqli_connect($host, $username, $password); $conn = mysql_connect($host, $username, $password) or die("Could not connect: " . mysql_error()); mysql_select_db($database); session_start(); IF (isset($_SESSION['userid'])){ $userid=$_SESSION['userid']; echo $userid; } //$currentUser = $_SESSION['myusername']; //do some cleanup// IF (isset($_POST['submit'])){ $first = $_POST['first']; $last = $_POST['last']; $dob = $_POST['dob']; $gender = $_POST['gender']; $country = $_POST['country']; $state = $_POST['state']; $town = $_POST['town']; $zip = $_POST['zip']; $email = $_POST['email']; $first = mysql_real_escape_string( '$first'); $last = mysql_real_escape_string( '$last'); $dob = mysql_real_escape_string( '$dob'); $gender = mysql_real_escape_string( '$gender'); $country = mysql_real_escape_string( '$country'); $state = mysql_real_escape_string( '$state'); $town = mysql_real_escape_string( '$town'); $zip = mysql_real_escape_string( '$zip'); $email = mysql_real_escape_string( '$email'); }; IF (isset($_SESSION['userid'])){ $userid=$_SESSION['userid']; } ELSE{ $getuserid=mysql_query ("SELECT id FROM users ORDER BY id DESC limit 1") or die(mysql_error()); WHILE ($gtuserid = mysql_fetch_array($getuserid)) { $theuserid=$gtuserid['id']; $userid=$theuserid; $_SESSION['userid']=$theuserid; $userid=$_SESSION['userid']; }//$getuserid }// IF ELSE (isset($_SESSION['userid'])) /////UPDATE SECTION///// IF (isset($_POST['submit'])){ mysql_query ( "UPDATE users SET firstname='$first', lastname='$last', dob = '$dob', gender='$gender', country='$country', state='$state', town='$town', zip='$zip', email='$email' WHERE id=$userid") or die(mysql_error()); }//IF ($_POST['update']=="Update") ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Connection</title> <style type="text/css"> body { font-family:Calibri; font-size:1em; } .title { font-size:1.6em; font-weight:strong; } .links a{ font-size::1.2em; text-decoration:none; } .links a:hover{ font-size::1.2em; color:#0066FF; text-decoration:none; } </style> </head> <body> <p><span class="title">Add your personal information/span></p> <form action="thebeast.php" method="post"> <p> <input type="text" name="first" size="20" id="first" /> First name<br /> <input type="text" name="last" size="20" id="name" /> Last name<br /> <input name="dob" type="text" size="20" id="dob" ; } ?> Date of Birth<br /> <input type="text" name="gender" size="20" id="gender" /> Gender <br /> <input type="text" name="country" size="20" id="country" /> Country<br /> <input type="text" name="state" size="20" id="state" /> State<br /> <input type="text" name="town" size="20" id="town" /> Town<br /> <input type="text" name="zip" size="20" id="zip" /> Zip Code<br /> <input type="text" name="email" size="40" id="email" /> Email<br /> <br /> <input type="submit" name="submit" value="Add your information" /> </form> </body> </html> Hi I have a single page submission update page which incorporates 7 drop down menus and 2 text input fields, everything works fine with the data updating back to the database, the only thing is that when the page is updated all the drop down menus are updated which includes ones that I don't want updated? I need to only update the drop down menus that have been selected? but am unsure how I do it? This is the code from the page, sorry if its a mess but I am not that experienced at the moment. This is a snippet of one of the drop down menus Code: [Select] <tr> <td class="heading">Current Status</td> <td><?php echo $statusdescrip ['status_description']; ?> <select name="status_id" > <?php $status_set = findstatus(); $statuslist = mysql_fetch_assoc ($status_set); ?> <?php do { ?> <option value="<?php echo $statuslist ['status_id']; ?>" ><?php echo $statuslist ['status_description']; ?></option> <?php } while ($statuslist = mysql_fetch_assoc ($status_set)); ?></select> <span class="compuls">*</span></td> </tr> Below I am checking a user level and if they are level one they see some of the form, and if level two they see additional options. What they have already filled out is to show in the text field. Before I was doing the user level check it worked fine. Even now if something is put in a field it saves in the DB but it will not show in the fields on the form. // Everyone sees <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['FieldA']; ?>"> </tr> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['FieldB']; ?>"> </tr> // Check if level two and display if they are. <?php } if (checkUser()) { ?> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num1']; ?>"> </tr> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num2']; ?>"> </tr> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num3']; ?>"> </tr> <?php } ?> // Additional things everyone sees even level one. <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num4']; ?>"> </tr> <tr> So even <?php echo $row_settings['num4']; ?> will not show/work after the <?php } ?> Any thoughts? Thanks in advance everyone. I was able to make my fields required and the user gets a message and has to go back and enter all of the required fields before they see a successful submission, but I still get an email every time they get the error message. Below is the code, thanks so much for your help. (fyi, i got all of the code from the web and changed to fit my needs, so I'm not entirely sure what it all does, if i had to guess, i would think the problem is in "$sent = mail($to, $subject, $body, $headers);", but that's just a guess) Code: [Select] <?php $to = "email@mydomain.com"; $email = $_REQUEST['email'] ; $fname = $_REQUEST['fname'] ; $lname = $_REQUEST['lname'] ; $phone = $_REQUEST['phone'] ; $type = $_REQUEST['type'] ; $details = $_REQUEST['details'] ; $subject = "Message from: $fname $lname"; $headers = "noreply@mydomain.com"; $body = "FirstName: $fname \n\n Lastname: $lname \n\n PhoneNumber: $phone \n\n Email: $email \n\n Type: $type \n\n Details: $details \n\n"; $sent = mail($to, $subject, $body, $headers) ; if ($_POST['fname']=="") { Print("Ooops, please use your back button and provide your first name!<br>"); } elseif ($_POST['lname']=="") { Print("Ooops, please use your back button and provide your last name!<br>"); } elseif ($_POST['phone']=="") { Print("Ooops, please use your back button and provide your phone number!<br>"); } elseif ($_POST['email']=="") { Print("Ooops, please use your back button and provide your email!<br>"); } elseif($sent) {echo "<script language=javascript>window.location = 'thanks.php';</script>";} else {echo "<script language=javascript>window.location = 'error.php';</script>";} ?> I was able to get the Billing Address part to work but the payment method is just not writing to the mail. Can someone please help me fix this? The mail code: Code: [Select] <?php $deny = array("61.21.111.134", "89.149.208.14", "85.17.147.193", "206.214.146.194", "66.249.67.199"); if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) { header("location: http://www.yahoo.com"); exit(); }session_start(); ?><?php session_start(); $to="xyz@abc.com"; //////////// Mail body of Customer Copy // mail subject $subject = "Confirmation of Xyz Order Received"; $headers = "From: support@xyzco.com\r\n"; $headers .= "Reply-To: support@xyzco.com\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= "X-Mailer: PHP/ . phpversion()\r\n"; // Text of body initial $message='<html><link href="http://xyzco.com/mail-style.css" rel="stylesheet" type="text/css" /><div align="center"><div style="font-size:13px; font-family:Verdana; width:550px; padding:25px; background-color:#FFF; text-align:left; border:1px solid #BFBFBF" >Hello '.$_POST['txtfname'].' '.$_POST['txtlname'].',<br><br> We have received your form submission. Thank you!<br><br> Below is the data submitted:</div></div><br> '; $message = $message.'<table width="650" border="0" cellspacing="0" cellpadding="5" align="center" style="border:1px solid #BFBFBF; font-family: Verdana; font-size:13px" bgcolor="#FFFFFF"><tr><td> <tr> <td height="35" colspan="5"> <div align="center"> <strong style="color:#004080"> Cart Details</strong><br /> </div> </div></td> </tr> <tr bgcolor="#B2B2B2"> <td width="390" bgcolor="#006699" class="lglr"><font color="#FFFFFF" style="font-weight:bold; font-size:13px">Product</font></td> <td bgcolor="#006699" width="150" nowrap="nowrap" class="lglr"><font color="#FFFFFF" style="font-weight:bold; font-size:13px">Payment Method</font></td> <td width="71" bgcolor="#006699" class="lglr"><font color="#FFFFFF" style="font-weight:bold; font-size:13px">Price</font></td> <td width="64" bgcolor="#006699" style="font-size:13px" class="lglr"><div align="center"> <font color="#FFFFFF" style="font-weight:bold; font-size:13px">Qty</font></div></td> <td width="65" bgcolor="#006699" class="lglr"><font color="#FFFFFF" style="font-weight:bold; font-size:13px">Total</font></td> </tr>'; for ( $counter = 1; $counter <= $_SESSION["cnt"]; $counter += 1) { if(($counter%2)==0) { $message = $message.' <tr bgcolor="#F2F2F2">'; } else { $message = $message.'<tr>'; } $message = $message.' <td style="font-size:13px" class="lglr">'.$_SESSION["title".$counter].'</td> <td style="font-size:13px" class="lglr">'.$_SESSION["paymentmethod".$counter].'</td> <td style="font-size:13px" class="lglr"> $'.$_SESSION["price".$counter].'</td> <td style="font-size:13px" class="lglr">'.$_SESSION["qty".$counter].'</td> <td style="font-size:13px" class="lglr">$'.$_SESSION["total".$counter].'</td> </tr> '; } $message = $message.' <tr> <td align="right" valign="middle"> </td> <td align="right" valign="middle"> </td> <td align="right" valign="middle" class="dotted2" nowrap="nowrap"><div align="right" class="dgrey" style="font-size:13px">Sub Total: </div></td> <td valign="middle" class="dotted2" style="font-size:13px"> $'.$_SESSION["grandtotal"].'</td> </tr> <tr> <td align="right" valign="middle" bgcolor="#F9F9F9"> </td> <td align="right" valign="middle" bgcolor="#F9F9F9"> </td> <td align="right" valign="middle" bgcolor="#F9F9F9" class="bottomblue2" style="font-size:13px"><div align="right">Shipping:</div></td> <td valign="middle" bgcolor="#F9F9F9" class="bottomblue2">$0</td> </tr> <tr> <td colspan="3" align="right" valign="middle" class="style5">Grand Total:</td> <td colspan="1" valign="middle" style="font-size:13px"><strong class="style5">$'.($_SESSION["grandtotal"] + 0).'</strong></td> </tr> </table><br>'; $message = $message.' <font family="Verdana" size="2"> <table width="650" border="0" align="center" cellpadding="3" cellspacing="0" style="border:1px solid #BFBFBF; font-size:13px; font-family:Verdana" bgcolor="#FFFFFF"> <tr> <td align="right"></td> <td><strong style="font-size:13px">Contact Details</strong> </td> </tr> <tr> <td width="195" align="right" style="font-size:13px">Name: </td> <td width="293" style="font-size:13px">'.$_POST['txtfname'].' '.$_POST['txtlname'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Email: </td> <td style="font-size:13px">'.$_POST['txtemail'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Phone: </td> <td style="font-size:13px"> '.$_POST['txtphone'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Alternate Phone: </td> <td style="font-size:13px"> '.$_POST['txtphone2'].' </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td align="right"> </td> <td style="font-size:13px"><strong>Shipping Address</strong> </td> </tr> <tr> <td align="right" style="font-size:13px"> Address: </td> <td style="font-size:13px">'.$_POST['txtaddress'].'</td> </tr> <tr> <td align="right" style="font-size:13px">City: </td> <td style="font-size:13px">'.$_POST['txtcity'].'</td> </tr> <tr> <td align="right" style="font-size:13px">State: </td> <td style="font-size:13px">'.$_POST['txtstate'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Zip: </td> <td style="font-size:13px">'.$_POST['txtzip'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Country: </td> <td style="font-size:13px">'.$_POST['txtcountry'].'</td> </tr> '; if($_POST['billing']=="billing") { $message = $message.='<tr><td><div align="right">Billing Address same as above.</div></td></tr>';} else if($_POST['billing']=="") { $message = $message.' <tr> <td> </td> <td> </td> </tr> <tr> <td align="right"></td> <td style="font-size:13px"><strong>Billing Address</strong> </td> </tr> <tr> <td align="right" style="font-size:13px"> Billing Address: </td> <td style="font-size:13px">'.$_POST['billing_address'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Billing City: </td> <td style="font-size:13px">'.$_POST['billing_city'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Billing State: </td> <td style="font-size:13px">'.$_POST['billing_state'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Billing Zip: </td> <td style="font-size:13px">'.$_POST['billing_zip'].'</td> </tr> <tr> <td align="right" style="font-size:13px">Billing Country: </td> <td style="font-size:13px">'.$_POST['billing_country'].'</td> </tr><tr><td></td></tr>';} $message = $message.' <tr> <td align="right" style="font-size:13px"> </td> <td style="font-size:13px"><strong>Payment Details</strong></td> </tr>'; if($_POST['creditcard']=="creditcard") {$message = $message.'<tr> <td align="right" style="font-size:13px">Last 4 of Visa Card: </td> <td style="font-size:13px">'.$_POST['cc4'].' </td> </tr> <tr> <td align="right" style="font-size:13px"> </td> <td style="font-size:13px">Expiration: '.$_POST['ccexp'].'</td> </tr>';} else if($_POST['creditcard']=="") { $message = $message."";} if($_POST['split']=="split") {$message = $message.'<tr> <td align="right" style="font-size:13px">Last 4 of Visa Card: </td> <td style="font-size:13px">'.$_POST['cc4'].' </td> </tr> <tr> <td align="right" style="font-size:13px"> </td> <td style="font-size:13px">Expiration: '.$_POST['ccexp'].'</td> </tr> <tr> <td style="font-size:13px">MoneyPak # '.$_POST['m-p-n'].' $'.$_POST['mpamt'].'</td> </tr> ';} else if($_POST['split']=="") { $message = $message."";} if($_POST['m-p']=="m-p") { $message = $message.'<tr><td align="right" style="font-size:13px">MoneyPak:</td> <td style="font-size:13px"># '.$_POST['m-p-1'].'</td></tr>';} else if($_POST['m-p']=="") { $message = $message.'';} $message = $message.' <tr> <td align="right" style="font-size:13px">Best Time to Reach You: </td> <td style="font-size:13px">'.$_POST['txtcall'].'</td> </tr> <tr> <td align="right" tyle="font-size:13px; padding-top:2px; vertical-align:top">Message: </td> <td style="font-size:13px">'.$_POST['message'].'</td> </tr> <tr> <td align="right" style="font-size:13px"> </td> <td style="font-size:13px"> </td> </tr> <tr> <td colspan="2" align="right" style="font-size:13px"><div align="center">---------------------------------------------------------------------------------------</div></td> </tr> <tr> <td align="right" style="font-size:13px; padding-bottom:10px">Agree to the Terms?: '.$_POST['agree'].' </td> <td style="font-size:13px; padding-bottom:10px">IP: '.$_SERVER['REMOTE_ADDR'].'</td> </tr></table> '; $message = $message.'<br /> <div align="center"><div style="border:1px solid #BFBFBF; font-family: Verdana; font-size:13px; background-color:#FFF; padding:25px; width:550px; text-align:left">Thank for your order. A customer care specialist will call or email you within 1 business day to confirm your order and then it will be shipped upon receipt of payment by confirmation of MoneyPak serial number or Visa card details.<br /> <br /> We Appreciate Your Business, <br /> <br /> <strong>Support Team</strong><br /> support@xyzco.com</span><br /> <img src="http://xyzco.com/images/logosm.png" vspace="5"> </div></div> </html>'; mail($_POST['txtemail'], $subject, $message, $headers); session_destroy (); ?> <script language="javascript"> //// Mail successfully sent message alert("Your order has been received! Thank you.\n An email receipt was sent. \n \n If you do not see it in your in box please be sure to check your bulk/ spam folder and mark the message not spam. Please add support@xyzco.com to your contact/ safe list.\n \n \n \nYou will now be redirected to our reccomended add on product."); document.location.href="xyzlink"; </script> <style type="text/css"> <!-- .style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } --> </style> I am realy doing my best , but i am bad at php , when i click update bottum on edit_profil.php page it put me over to update.php, but update.php is blank , and cant see any errors. and it has not updated mysql. Files: // form page. edit_profil.php // Data from edit_profil to mysql update.php ___________________________ edit_profil.php Code: [Select] <?php // Check if user is logged in session_start(); if ($_SESSION['s_logged_n'] == 'true'){ $username = $_SESSION['s_username']; $usermail = $_SESSION['s_usermail']; // Get the id if (isset($_GET['id'])){ // Include config file include "config.php"; // Define id $id = $_GET['id']; // Query table $query = "SELECT * FROM users WHERE user_id = '$id' AND username = '$username' LIMIT 1"; $result = mysql_query($query); $check = mysql_num_rows($result); // If user try to edit someone's else profile it will say it can't if (!$check == 1){ echo "You can edit your profile only"; // Else if everything is ok display form } 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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="css/test.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="bodyContentCenter"> <h1>My Profile</h1> <div class="solidThickLine"></div> <div class="breakLine"><!-- --></div> <div class="loginColumnBorder" style="width:100%;"> <form action="update.php?id=<?php echo "$id" ?>" method="post"> <table border="0" width="100%" cellspacing="10" cellpadding="0"> <tbody><tr> <td> <div style="font-size:16px;font-weight:bold;">Edit Profile</div> <div class="breakLine"><!-- --></div> <div>Personal information obtained are used solely for the purpose of enhancing the functionality and level of service.</div> <div class="breakLine" style="height:20px;"><!-- --></div> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tbody><tr><td colspan="3" style="font-weight:bold">LOGIN E-MAIL & PASSWORD</td></tr> <tr><td colspan="3"><div class="breakLine"></div></td></tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">E-mail Address:</td> <td style="width:220px;"> <label for="e_mail_address"></label> <input type="text" name="e_mail_address" value="<?php echo "$usermail"; ?>" id="e_mail_address"> *</td> </tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">New Password:</td> <td style="width:220px;"> <label for="password"></label> <input type="password" name="password" id="password"> *</td> </tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">Confirm New Password:</td> <td style="width:220px;"><label for="password_confirm"></label> <input type="password" name="password_confirm" id="password_confirm"> *</td> <td style="width:380px;"><div id="confirm_password_message"></div> </td> </tr> <tr><td colspan="3"><div class="dottedLine" style="lin-height: 2px;"> </div></td></tr> <!--tr><td colspan="3"><div class="breakLine"></div></td></tr--> <tr><td colspan="3" style="font-weight:bold" valign="top">PERSONAL DETAILS</td></tr> <tr><td colspan="3"><div class="breakLine"></div></td></tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">First Name:</td> <td style="width:220px;"><input type="text" name="edit_profile_firstname" value="lasse" id="firstname"> *</td> </tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">Last Name:</td> <td style="width:220px;"><input type="text" name="edit_profile_lastname" id="lastname"> *</td> </tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">Country Code: </td> <td style="width:220px;"><select name="edit_profile_country_code" style="width:150px;" id="country"><option value="1">Afghanistan +93</option><option value="2">Albania +355</option><option value="3">Algeria +213</option><option value="4">American Samoa +684</option><option value="5">Andorra +376</option><option value="6">Angola +244</option><option value="7">Anguilla +1264</option><option value="8">Antarctica +672</option><option value="9">Antigua and Barbuda +1268</option><option value="10">Argentina +54</option><option value="11">Armenia +374</option><option value="12">Aruba +297</option><option value="13">Australia +61</option><option value="14">Austria +43</option><option value="15">Azerbaijan +994</option><option value="16">Bahamas +1242</option><option value="17">Bahrain +973</option><option value="18">Bangladesh +880</option><option value="19">Barbados +1246</option><option value="20">Belarus +375</option><option value="21">Belgium +32</option><option value="22">Belize +501</option><option value="23">Benin +229</option><option value="24">Bermuda +1441</option><option value="25">Bhutan +975</option><option value="26">Bolivia +591</option><option value="27">Bosnia and Herzegovina +387</option><option value="28">Botswana +267</option><option value="29">Bouvet Island +47</option><option value="30">Brazil +55</option><option value="31">British Indian Ocean Territory +246</option><option value="32">Brunei Darussalam +673</option><option value="33">Bulgaria +359</option><option value="34">Burkina Faso +226</option><option value="35">Burundi +257</option><option value="36">Cambodia +855</option><option value="37">Cameroon +237</option><option value="38">Canada +1</option><option value="39">Cape Verde +238</option><option value="40">Cayman Islands +1345</option><option value="41">Central African Republic +236</option><option value="42">Chad +235</option><option value="43">Chile +56</option><option value="44">China +86</option><option value="45">Christmas Island +61</option><option value="46">Cocos (Keeling) Islands +61</option><option value="47">Colombia +57</option><option value="48">Comoros +269</option><option value="49">Congo +242</option><option value="50">Cook Islands +682</option><option value="51">Costa Rica +506</option><option value="52">Cote D'Ivoire +225</option><option value="53">Croatia +385</option><option value="54">Cuba +53</option><option value="55">Cyprus +357</option><option value="56">Czech Republic +420</option><option value="57" selected="">Denmark +45</option><option value="58">Djibouti +253</option><option value="59">Dominica +1767</option><option value="60">Dominican Republic +1809</option><option value="61">East Timor +670</option><option value="62">Ecuador +593</option><option value="63">Egypt +20</option><option value="64">El Salvador +503</option><option value="65">Equatorial Guinea +240</option><option value="66">Eritrea +291</option><option value="67">Estonia +372</option><option value="68">Ethiopia +251</option><option value="69">Falkland Islands (Malvinas) +500</option><option value="70">Faroe Islands +298</option><option value="71">Fiji +679</option><option value="72">Finland +358</option><option value="73">France +33</option><option value="74">France, Metropolitan +33</option><option value="75">French Guiana +594</option><option value="76">French Polynesia +689</option><option value="77">French Southern Territories +</option><option value="78">Gabon +241</option><option value="79">Gambia +220</option><option value="80">Georgia +995</option><option value="81">Germany +49</option><option value="82">Ghana +233</option><option value="83">Gibraltar +350</option><option value="84">Greece +30</option><option value="85">Greenland +299</option><option value="86">Grenada +1473</option><option value="87">Guadeloupe +590</option><option value="88">Guam +1671</option><option value="89">Guatemala +502</option><option value="242">Guernsey +44</option><option value="90">Guinea +224</option><option value="91">Guinea-bissau +245</option><option value="92">Guyana +592</option><option value="93">Haiti +509</option><option value="94">Heard and Mc Donald Islands +672</option><option value="95">Honduras +504</option><option value="96">Hong Kong +852</option><option value="97">Hungary +36</option><option value="98">Iceland +354</option><option value="99">India +91</option><option value="100">Indonesia +62</option><option value="101">Iran (Islamic Republic of) +98</option><option value="102">Iraq +964</option><option value="103">Ireland +353</option><option value="104">Israel +972</option><option value="105">Italy +39</option><option value="106">Jamaica +1876</option><option value="107">Japan +81</option><option value="108">Jordan +962</option><option value="109">Kazakhstan +7</option><option value="110">Kenya +254</option><option value="111">Kiribati +686</option><option value="112">Korea, Democratic People's Republic of +850</option><option value="113">Korea, Republic of +82</option><option value="114">Kuwait +965</option><option value="115">Kyrgyzstan +996</option><option value="116">Lao People's Democratic Republic +856</option><option value="117">Latvia +371</option><option value="118">Lebanon +961</option><option value="119">Lesotho +266</option><option value="120">Liberia +231</option><option value="121">Libyan Arab Jamahiriya +218</option><option value="122">Liechtenstein +423</option><option value="123">Lithuania +370</option><option value="124">Luxembourg +352</option><option value="125">Macau +853</option><option value="126">Macedonia, The Former Yugoslav Republic of +389</option><option value="127">Madagascar +261</option><option value="128">Malawi +265</option><option value="129">Malaysia +60</option><option value="130">Maldives +960</option><option value="131">Mali +223</option><option value="132">Malta +356</option><option value="133">Marshall Islands +692</option><option value="134">Martinique +596</option><option value="135">Mauritania +222</option><option value="136">Mauritius +230</option><option value="137">Mayotte +269</option><option value="138">Mexico +52</option><option value="139">Micronesia, Federated States of +591</option><option value="140">Moldova, Republic of +373</option><option value="141">Monaco +377</option><option value="142">Mongolia +976</option><option value="241">Montenegro +382</option><option value="143">Montserrat +1664</option><option value="144">Morocco +212</option><option value="145">Mozambique +258</option><option value="146">Myanmar +95</option><option value="147">Namibia +264</option><option value="148">Nauru +674</option><option value="149">Nepal +977</option><option value="150">Netherlands +31</option><option value="151">Netherlands Antilles +599</option><option value="152">New Caledonia +687</option><option value="153">New Zealand +64</option><option value="154">Nicaragua +505</option><option value="155">Niger +227</option><option value="156">Nigeria +234</option><option value="157">Niue +683</option><option value="158">Norfolk Island +672</option><option value="159">Northern Mariana Islands +1670</option><option value="160">Norway +47</option><option value="161">Oman +968</option><option value="162">Pakistan +92</option><option value="163">Palau +680</option><option value="164">Panama +507</option><option value="165">Papua New Guinea +675</option><option value="166">Paraguay +595</option><option value="167">Peru +51</option><option value="168">Philippines +63</option><option value="169">Pitcairn +872</option><option value="170">Poland +48</option><option value="171">Portugal +351</option><option value="172">Puerto Rico +1787</option><option value="173">Qatar +974</option><option value="174">Reunion +262</option><option value="175">Romania +40</option><option value="176">Russian Federation +7</option><option value="177">Rwanda +250</option><option value="178">Saint Kitts and Nevis +1869</option><option value="179">Saint Lucia +1758</option><option value="180">Saint Vincent and the Grenadines +1784</option><option value="181">Samoa +685</option><option value="182">San Marino +378</option><option value="183">Sao Tome and Principe +239</option><option value="184">Saudi Arabia +966</option><option value="185">Senegal +221</option><option value="240">Serbia +381</option><option value="186">Seychelles +248</option><option value="187">Sierra Leone +232</option><option value="188">Singapore +65</option><option value="189">Slovakia (Slovak Republic) +421</option><option value="190">Slovenia +386</option><option value="191">Solomon Islands +677</option><option value="192">Somalia +252</option><option value="193">South Africa +27</option><option value="194">South Georgia and the South Sandwich Islands +</option><option value="195">Spain +34</option><option value="196">Sri Lanka +94</option><option value="197">St. Helena +290</option><option value="198">St. Pierre and Miquelon +508</option><option value="199">Sudan +249</option><option value="200">Suriname +597</option><option value="201">Svalbard and Jan Mayen Islands +79</option><option value="202">Swaziland +268</option><option value="203">Sweden +46</option><option value="204">Switzerland +41</option><option value="205">Syrian Arab Republic +963</option><option value="206">Taiwan +886</option><option value="207">Tajikistan +992</option><option value="208">Tanzania, United Republic of +255</option><option value="209">Thailand +66</option><option value="210">Togo +228</option><option value="211">Tokelau +690</option><option value="212">Tonga +676</option><option value="213">Trinidad and Tobago +1868</option><option value="214">Tunisia +216</option><option value="215">Turkey +90</option><option value="216">Turkmenistan +993</option><option value="217">Turks and Caicos Islands +1649</option><option value="218">Tuvalu +688</option><option value="219">Uganda +256</option><option value="220">Ukraine +380</option><option value="221">United Arab Emirates +971</option><option value="222">United Kingdom +44</option><option value="223">United States +1</option><option value="224">United States Minor Outlying Islands +1</option><option value="225">Uruguay +598</option><option value="226">Uzbekistan +998</option><option value="227">Vanuatu +678</option><option value="228">Vatican City State (Holy See) +39</option><option value="229">Venezuela +58</option><option value="230">Vietnam +84</option><option value="231">Virgin Islands (British) +284</option><option value="232">Virgin Islands (U.S.) +1340</option><option value="233">Wallis and Futuna Islands +681</option><option value="234">Western Sahara +212</option><option value="235">Yemen +967</option><option value="237">Zaire +243</option><option value="238">Zambia +260</option><option value="239">Zimbabwe +263</option></select> *</td> </tr> <tr style="height:60px;" valign="top"> <td style="width:120px;">Contact Number: </td> <td style="width:220px;"><input type="text" name="edit_profile_contact_number" autocomplete="off" id="contact_number"> *</td> </tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">Gender:</td> <td style="width:220px;"> <select name="edit_profile_gender" id="edit_profile_gender"><option>Female</option><option>Male</option> </select> </td> <td style="width:380px;"> </td> </tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">Date of Birth:</td> <td style="width:220px;"><select name="dob_month" id="month"><option value="01">January</option><option value="02">February</option><option value="03">March</option><option value="04">April</option><option value="05">May</option><option value="06">June</option><option value="07" selected="">July</option><option value="08">August</option><option value="09">September</option><option value="10">October</option><option value="11">November</option><option value="12">December</option></select> <select name="dob_day" id="day"><option value="01">01</option><option value="02">02</option><option value="03">03</option><option value="04">04</option><option value="05">05</option><option value="06">06</option><option value="07">07</option><option value="08">08</option><option value="09">09</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23" selected="">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option></select> <select name="dob_year" id="year"><option value="1900">1900</option><option value="1901">1901</option><option value="1902">1902</option><option value="1903">1903</option><option value="1904">1904</option><option value="1905">1905</option><option value="1906">1906</option><option value="1907">1907</option><option value="1908">1908</option><option value="1909">1909</option><option value="1910">1910</option><option value="1911">1911</option><option value="1912">1912</option><option value="1913">1913</option><option value="1914">1914</option><option value="1915">1915</option><option value="1916">1916</option><option value="1917">1917</option><option value="1918">1918</option><option value="1919">1919</option><option value="1920">1920</option><option value="1921">1921</option><option value="1922">1922</option><option value="1923">1923</option><option value="1924">1924</option><option value="1925">1925</option><option value="1926">1926</option><option value="1927">1927</option><option value="1928">1928</option><option value="1929">1929</option><option value="1930">1930</option><option value="1931">1931</option><option value="1932">1932</option><option value="1933">1933</option><option value="1934">1934</option><option value="1935">1935</option><option value="1936">1936</option><option value="1937">1937</option><option value="1938">1938</option><option value="1939">1939</option><option value="1940">1940</option><option value="1941">1941</option><option value="1942">1942</option><option value="1943">1943</option><option value="1944">1944</option><option value="1945">1945</option><option value="1946">1946</option><option value="1947">1947</option><option value="1948">1948</option><option value="1949">1949</option><option value="1950">1950</option><option value="1951">1951</option><option value="1952">1952</option><option value="1953">1953</option><option value="1954">1954</option><option value="1955">1955</option><option value="1956">1956</option><option value="1957">1957</option><option value="1958">1958</option><option value="1959">1959</option><option value="1960">1960</option><option value="1961">1961</option><option value="1962">1962</option><option value="1963">1963</option><option value="1964">1964</option><option value="1965">1965</option><option value="1966">1966</option><option value="1967">1967</option><option value="1968">1968</option><option value="1969">1969</option><option value="1970">1970</option><option value="1971">1971</option><option value="1972">1972</option><option value="1973">1973</option><option value="1974">1974</option><option value="1975">1975</option><option value="1976">1976</option><option value="1977">1977</option><option value="1978">1978</option><option value="1979">1979</option><option value="1980">1980</option><option value="1981">1981</option><option value="1982">1982</option><option value="1983">1983</option><option value="1984">1984</option><option value="1985">1985</option><option value="1986">1986</option><option value="1987">1987</option><option value="1988">1988</option><option value="1989" selected="">1989</option><option value="1990">1990</option><option value="1991">1991</option><option value="1992">1992</option><option value="1993">1993</option><option value="1994">1994</option><option value="1995">1995</option><option value="1996">1996</option><option value="1997">1997</option><option value="1998">1998</option><option value="1999">1999</option><option value="2000">2000</option><option value="2001">2001</option><option value="2002">2002</option><option value="2003">2003</option><option value="2004">2004</option><option value="2005">2005</option><option value="2006">2006</option><option value="2007">2007</option><option value="2008">2008</option><option value="2009">2009</option><option value="2010">2010</option></select></td> <td style="width:380px;"><div id="dob_message"></div> </td> </tr> <tr style="height:45px;" valign="top"> </tr> <tr><td colspan="3"><a name="ba"></a><div class="breakLine"></div></td></tr> <tr> <td colspan="3" style="font-weight:bold">ADDRESS</td></tr> <tr><td colspan="3"><div class="breakLine"></div></td></tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">Address1: </td> <td style="width:220px;"> <input type="text" name="edit_profile_billing_address1" id="billing_address1"> *</td> </tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">Address2: </td> <td style="width:220px;"> <input type="text" name="edit_profile_billing_address2" id="billing_address2"> *</td> </tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">City:</td> <td style="width:220px;"> <input type="text" name="edit_profile_billing_city" id="billing_city"> *</td> </tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">Zip/Post Code:</td> <td style="width:220px;"> <input type="text" name="edit_profile_billing_postcode" id="billing_postcode"> *</td> </tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">Country:</td> <td style="width:220px;"> <select name="edit_profile_billing_country" style="width:150px;" id="billing_country"><option value="1">Afghanistan</option><option value="2">Albania</option><option value="3">Algeria</option><option value="4">American Samoa</option><option value="5">Andorra</option><option value="6">Angola</option><option value="7">Anguilla</option><option value="8">Antarctica</option><option value="9">Antigua and Barbuda</option><option value="10">Argentina</option><option value="11">Armenia</option><option value="12">Aruba</option><option value="13">Australia</option><option value="14">Austria</option><option value="15">Azerbaijan</option><option value="16">Bahamas</option><option value="17">Bahrain</option><option value="18">Bangladesh</option><option value="19">Barbados</option><option value="20">Belarus</option><option value="21">Belgium</option><option value="22">Belize</option><option value="23">Benin</option><option value="24">Bermuda</option><option value="25">Bhutan</option><option value="26">Bolivia</option><option value="27">Bosnia and Herzegovina</option><option value="28">Botswana</option><option value="29">Bouvet Island</option><option value="30">Brazil</option><option value="31">British Indian Ocean Territory</option><option value="32">Brunei Darussalam</option><option value="33">Bulgaria</option><option value="34">Burkina Faso</option><option value="35">Burundi</option><option value="36">Cambodia</option><option value="37">Cameroon</option><option value="38">Canada</option><option value="39">Cape Verde</option><option value="40">Cayman Islands</option><option value="41">Central African Republic</option><option value="42">Chad</option><option value="43">Chile</option><option value="44">China</option><option value="45">Christmas Island</option><option value="46">Cocos (Keeling) Islands</option><option value="47">Colombia</option><option value="48">Comoros</option><option value="49">Congo</option><option value="50">Cook Islands</option><option value="51">Costa Rica</option><option value="52">Cote D'Ivoire</option><option value="53">Croatia</option><option value="54">Cuba</option><option value="55">Cyprus</option><option value="56">Czech Republic</option><option value="57" selected="">Denmark</option><option value="58">Djibouti</option><option value="59">Dominica</option><option value="60">Dominican Republic</option><option value="61">East Timor</option><option value="62">Ecuador</option><option value="63">Egypt</option><option value="64">El Salvador</option><option value="65">Equatorial Guinea</option><option value="66">Eritrea</option><option value="67">Estonia</option><option value="68">Ethiopia</option><option value="69">Falkland Islands (Malvinas)</option><option value="70">Faroe Islands</option><option value="71">Fiji</option><option value="72">Finland</option><option value="73">France</option><option value="74">France, Metropolitan</option><option value="75">French Guiana</option><option value="76">French Polynesia</option><option value="77">French Southern Territories</option><option value="78">Gabon</option><option value="79">Gambia</option><option value="80">Georgia</option><option value="81">Germany</option><option value="82">Ghana</option><option value="83">Gibraltar</option><option value="84">Greece</option><option value="85">Greenland</option><option value="86">Grenada</option><option value="87">Guadeloupe</option><option value="88">Guam</option><option value="89">Guatemala</option><option value="242">Guernsey</option><option value="90">Guinea</option><option value="91">Guinea-bissau</option><option value="92">Guyana</option><option value="93">Haiti</option><option value="94">Heard and Mc Donald Islands</option><option value="95">Honduras</option><option value="96">Hong Kong</option><option value="97">Hungary</option><option value="98">Iceland</option><option value="99">India</option><option value="100">Indonesia</option><option value="101">Iran (Islamic Republic of)</option><option value="102">Iraq</option><option value="103">Ireland</option><option value="104">Israel</option><option value="105">Italy</option><option value="106">Jamaica</option><option value="107">Japan</option><option value="108">Jordan</option><option value="109">Kazakhstan</option><option value="110">Kenya</option><option value="111">Kiribati</option><option value="112">Korea, Democratic People's Republic of</option><option value="113">Korea, Republic of</option><option value="114">Kuwait</option><option value="115">Kyrgyzstan</option><option value="116">Lao People's Democratic Republic</option><option value="117">Latvia</option><option value="118">Lebanon</option><option value="119">Lesotho</option><option value="120">Liberia</option><option value="121">Libyan Arab Jamahiriya</option><option value="122">Liechtenstein</option><option value="123">Lithuania</option><option value="124">Luxembourg</option><option value="125">Macau</option><option value="126">Macedonia, The Former Yugoslav Republic of</option><option value="127">Madagascar</option><option value="128">Malawi</option><option value="129">Malaysia</option><option value="130">Maldives</option><option value="131">Mali</option><option value="132">Malta</option><option value="133">Marshall Islands</option><option value="134">Martinique</option><option value="135">Mauritania</option><option value="136">Mauritius</option><option value="137">Mayotte</option><option value="138">Mexico</option><option value="139">Micronesia, Federated States of</option><option value="140">Moldova, Republic of</option><option value="141">Monaco</option><option value="142">Mongolia</option><option value="241">Montenegro</option><option value="143">Montserrat</option><option value="144">Morocco</option><option value="145">Mozambique</option><option value="146">Myanmar</option><option value="147">Namibia</option><option value="148">Nauru</option><option value="149">Nepal</option><option value="150">Netherlands</option><option value="151">Netherlands Antilles</option><option value="152">New Caledonia</option><option value="153">New Zealand</option><option value="154">Nicaragua</option><option value="155">Niger</option><option value="156">Nigeria</option><option value="157">Niue</option><option value="158">Norfolk Island</option><option value="159">Northern Mariana Islands</option><option value="160">Norway</option><option value="161">Oman</option><option value="162">Pakistan</option><option value="163">Palau</option><option value="164">Panama</option><option value="165">Papua New Guinea</option><option value="166">Paraguay</option><option value="167">Peru</option><option value="168">Philippines</option><option value="169">Pitcairn</option><option value="170">Poland</option><option value="171">Portugal</option><option value="172">Puerto Rico</option><option value="173">Qatar</option><option value="174">Reunion</option><option value="175">Romania</option><option value="176">Russian Federation</option><option value="177">Rwanda</option><option value="178">Saint Kitts and Nevis</option><option value="179">Saint Lucia</option><option value="180">Saint Vincent and the Grenadines</option><option value="181">Samoa</option><option value="182">San Marino</option><option value="183">Sao Tome and Principe</option><option value="184">Saudi Arabia</option><option value="185">Senegal</option><option value="240">Serbia</option><option value="186">Seychelles</option><option value="187">Sierra Leone</option><option value="188">Singapore</option><option value="189">Slovakia (Slovak Republic)</option><option value="190">Slovenia</option><option value="191">Solomon Islands</option><option value="192">Somalia</option><option value="193">South Africa</option><option value="194">South Georgia and the South Sandwich Islands</option><option value="195">Spain</option><option value="196">Sri Lanka</option><option value="197">St. Helena</option><option value="198">St. Pierre and Miquelon</option><option value="199">Sudan</option><option value="200">Suriname</option><option value="201">Svalbard and Jan Mayen Islands</option><option value="202">Swaziland</option><option value="203">Sweden</option><option value="204">Switzerland</option><option value="205">Syrian Arab Republic</option><option value="206">Taiwan</option><option value="207">Tajikistan</option><option value="208">Tanzania, United Republic of</option><option value="209">Thailand</option><option value="210">Togo</option><option value="211">Tokelau</option><option value="212">Tonga</option><option value="213">Trinidad and Tobago</option><option value="214">Tunisia</option><option value="215">Turkey</option><option value="216">Turkmenistan</option><option value="217">Turks and Caicos Islands</option><option value="218">Tuvalu</option><option value="219">Uganda</option><option value="220">Ukraine</option><option value="221">United Arab Emirates</option><option value="222">United Kingdom</option><option value="223">United States</option><option value="224">United States Minor Outlying Islands</option><option value="225">Uruguay</option><option value="226">Uzbekistan</option><option value="227">Vanuatu</option><option value="228">Vatican City State (Holy See)</option><option value="229">Venezuela</option><option value="230">Vietnam</option><option value="231">Virgin Islands (British)</option><option value="232">Virgin Islands (U.S.)</option><option value="233">Wallis and Futuna Islands</option><option value="234">Western Sahara</option><option value="235">Yemen</option><option value="237">Zaire</option><option value="238">Zambia</option><option value="239">Zimbabwe</option></select> </td> <td style="width:380px;"><div id="billing_country_message"></div> </td> </tr> <tr style="height:45px;" valign="top"> <td style="width:120px;">State/Province:</td> <td style="width:220px;"> <span id="state_div" style="float:left;"> <label for="state_province"></label> <input type="text" name="state_province" id="state_province"> *</span></td> </tr> <tr valign="top"> <td colspan="3" style="width:100%;"> <div class="breakLine"><!-- --></div> <div class="dottedLine"><!-- --></div> <div class="breakLine"><!-- --></div> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody> </tbody></table> <div class="breakLine"><!-- --></div> </td> </tr> <tr><td colspan="3"><div class="dottedLine"> </div></td></tr> <!--tr><td colspan="3"><div class="breakLine"></div></td></tr--> <tr> <td colspan="3"> <div style="height:66px; display: block;"> <div style="float:left; width:50px; display: inline-block;"> <div class="loginBoxLink"<a href="#"><a href="index.php"><img src="images/buttoms/button_back.gif" border="0" width="51" height="17" longdesc="index.php" /></a></div> </div> <div style="float:right;"> <INPUT TYPE="image" SRC="images/buttoms/button_update.gif" HEIGHT="17" WIDTH="66" BORDER="0" ALT="Submit Form"> </div> </div> </td> </tr> </tbody></table> </td> </tr> </tbody></table> </form> </div> <div class="break_line"></div> </div> <?php } } } else { // If user is not logged in and opens edit page output that he must be logged in echo "You must be logged in to edit profile"; } ?> </body> </html> update.php Code: [Select] <?php // Start session session_start(); if($_SESSION['s_logged_n'] == 'true'){ // Define $username $username = $_SESSION['s_username']; $new_user_mail = $_POST["e_mail_address"]; $year = $_POST["year"]; $day = $_POST["day"]; $month = $_POST["month"]; $state_province = $_POST["state_province"]; $billing_postcode = $_POST["billing_postcode"]; $billing_country = $_POST["billing_country"]; $billing_city = $_POST["billing_city"]; $billing_address2 = $_POST["billing_address2"]; $billing_address1 = $_POST["billing_address1"]; $edit_profile_gender = $_POST["edit_profile_gender"]; $lastname = $_POST["lastname"]; $contact_number = $_POST["contact_number"]; $country = $_POST["country"]; $firstname = $_POST["firstname"]; // Check if form button update has been pressed if(isset($_POST['update'])){ // Get the id $id = $_GET['id']; // Include config file include "config.php"; // Add slashes and trim password $password = addslashes(trim($password)); $password_confirm = addslashes(trim($password_confirm)); // Check if passwords match each other if ($password == $password_confirm){ // If they do then do md5 hash on it $password = md5($password); // Query users table $query = "UPDATE users SET password = '$password', email = '$new_user_mail', dateofbirth = '$month$day$year', first_name = '$firstname', last_name = '$lastname', country_code = '$billing_postcode', contact_cumber = '$contact_number', gender = '$edit_profile_gender', address_1 = '$billing_address1', address_2 = '$billing_address2', city = '$country', zip_post_code = '$billing_postcode', country = '$country', state_province = '$state_province' WHERE user_id = '$id' AND username = '$username' LIMIT 1"; $result = mysql_query($query); // If it was successfull change of pass then output it if($result){ echo "You have successfully edited your password"; } else { // Else output error echo "There was an error editing your password"; } } else { // If passwords don't match each other say so echo "Your passwords don't match each other"; } } } else { // If someone just try to open file then stop them echo "You must be logged in to access this area"; } ?> mysql database table: users Code: [Select] username email password date ip actkey activated user_id points first_name last_name country_code contact_cumber gender dateofbirth address_1 address_2 city zip_post_code country state_province so if some one please give me a hit or help to get it done thanks Hey guys,
Thank you in advance... here is my situation, I have a form with three (3) fields in it, the 'student name' is unlimited textfield with an "add more" button to it and I have two select fields ('number of shirts' and 'trophies') that depend on the number of entries for 'student name'...
I want to create the select fields based on this math, for as many 'student name' entries:
1- i want to have the select form for 'number of shirts' to be 0 up to that number... so if there are 6 'student name' entries, the select options will be 0,1,3,4,5,6,7
2- I want to have the select form for 'trophies' to be 5 'student name' entries to 1 'trophies', for example if there are 6 'student name' entries, the select options will be 0,1... if there are 13 entries, options will be 0,1,2... So if there are less than 5 'student name' entries, the select field will not show (hidden)
of course if there are no 'student name' entries, these two fields won't show up (hidden)
let me know if that make sense and ANY help or directions will be GREATLY APPRECIATED.
Thanks guys!
I would appreciate your assistance, there are tons of login scripts and they work just fine. However I need my operators to login and then list their activities for the other operators who are logged in to see and if desired send their clients on the desired activity. I have the login working like a charm and the activities are listed just beautifully. How do I combine the two tables in the MySQL with PHP so the operator Logged in can only make changes to his listing but see the others. FIRST THE ONE script the member logges in here to the one table in MSQL: <?php session_start(); require_once('config.php'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } $login = clean($_POST['login']); $password = clean($_POST['password']); if($login == '') { $errmsg_arr[] = 'Login ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'Password missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: login-form.php"); exit(); } $qry="SELECT * FROM members WHERE login='$login' AND passwd='".md5($_POST['password'])."'"; $result=mysql_query($qry); if($result) { if(mysql_num_rows($result) == 1) { session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID'] = $member['member_id']; $_SESSION['SESS_FIRST_NAME'] = $member['firstname']; $_SESSION['SESS_LAST_NAME'] = $member['lastname']; session_write_close(); header("location: member-index.php"); exit(); }else { header("location: login-failed.php"); exit(); } }else { die("Query failed"); } ?> ................................................. ................................ Now I need the person who logged in to the table above to be able to make multiple entries to the table below <? $ID=$_POST['ID']; $title=$_POST['title']; $cost=$_POST['cost']; $activity=$_POST['activity']; $ayear=$_POST['aday']; $aday=$_POST['ayear']; $seats=$_POST['special']; $special=$_POST['seats']; mysql_connect("xxxxxx", "xxx350234427", "========") or die(mysql_error()); mysql_select_db("xxxx") or die(mysql_error()); mysql_query("INSERT INTO `activity` VALUES ('ID','$title', '$cost','$activity', '$aday', '$ayear', '$special', '$seats')"); Print "Your information has been successfully added to the database!" ?> Click <a href="member-profile.php">HERE</a> to return to the main menu <?php ?> hi, i have made a website where people resgister their details of them and products. they have to enter the following details in form Name of company name of the product company address email id password mobile number contact and brief details about their company
user can then login with email id and pwd. now after login ..user will get a page where he can upload the photos of products images and their price, so now my question is that when he finishes uploading (|by clicking on upload button) the product images and price text box ..then on final uploaded webspage it should show all other things which he registerd before (company name , mobile number etc) along with images and price...hence the main question that user does not need to enter mobile and address while uploading images and filling proce ..but on the final page it should show mobile and address along with price and images..as user is not going to enter mobile and address again and again as he will have multiple products to upload.
Hi, so far I have managed to set up a somewhat basic login website with a mysql database backend. Once they have logged on they go to a "main menu" page. What I need to define is that user A sees button A but only that button, etc. (Then of course that same rule would have to apply if they tried to directly go to the page, but I am guessing I can do that in the same way that I currently do to force a login). If anyone has any tutorials or sample code I would much appreciate it. Thanks, Actually, what i want to do is to use the email to fetch the $email,$password and $randomnumber from database after Hi guys, I am trying to put together a little system that allows users to log onto my website and access there own personal page. I am creating each page myself and uploading content specific to them which cannot be viewed by anyone else. I have got the system to work up as far as: 1/ The user logs in 2/ Once logged in they are re-directed to their own page using 'theirusername.php' Thats all good and working how I need it too. The problem I have is this. If I log onto the website using USER A details - I get taken to USER A's page like I should but - If I then go to my browser and type in USERBdetails.php I can then access USER B's page. This cannot happen!! I need for USER A not to be able to access USER B profile - there is obviously no point in the login otherwise! If you are not logged in you obviously cannot access any secure page. That much is working! Please find below the code I am using: LOGIN <?php session_start(); function dbconnect() { $link = mysql_connect("localhost", "username", "password") or die ("Error: ".mysql_error()); } ?> <?php if(isset($_SESSION['loggedin'])) { header("Location:" . strtolower($username) . ".php"); if(isset($_POST['submit'])) { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $mysql = mysql_query("SELECT * FROM clients WHERE username = '{$username}' AND password = '{$password}'"); if(mysql_num_rows($mysql) < 1) { die("Password or Username incorrect! Please <a href='login.php'>click here</a> to try again"); } $_SESSION['loggedin'] = "YES"; $_SESSION['username'] = $username; $_SESSION['name'] header("Location:" . strtolower($username) . ".php"); } ?> HEADER ON EACH PHP PAGE <?php session_start(); if(!isset($_SESSION['loggedin'])) { die(Access to this page is restricted without a valid username and password); ?> --------------------------------------------------- Am I right in thinking it is something to do with the "loggedin" part? The system I have here is adapted from a normal login system I have been using for years. The original just checks the details and then does a 'session start'. This one obviously has to re-direct to a user specific page. To do this I used the <<header("Location:" . strtolower($username) . ".php");>> line to redirect to a page such as "usera.php" or "userb.php" Any help would be greatly appreciated! Ta |