PHP - How Do I Populate Form Value="" With Mysql Data
Hello,
I am trying to populate the value="" of my form with the data from the mysql database so users can see what is already completed, trial and error have failed me. what am i doing wrong? <?php session_start(); include 'english.php'; if (!isset($_SESSION['user'])) die("<br /><br />You need to login to view this page"); $user = $_SESSION['user']; echo "<h3>Edit your Profile Search</h3>"; //opend database $connect = mysql_connect("$dbhost","$dbuser","$dbpass"); mysql_select_db("$dbname"); //select database // Get all the data from the "housing" table $result = mysql_query("SELECT * FROM users WHERE user='$user'") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) // Print out the contents of each row into a table ?> <form action="/includes/insert_profile.php" method="post"> <table border="0" cellspacing="0" cellpadding="3"> </td></tr> <tr><td>First Name:</td><td><input type="text" name="first" value="$first"> <tr><td>Middle Name:</td><td><input type="text" name="middle" value="$middle"> <tr><td>Last Name:</td><td><input type="text" name="last" value="$last"> <tr><td>Email:</td><td><input type="text" name="email" value="$email"> </td></tr> <tr><td>Date of Birth:</td><td> <select id="day" name="day" class="short"> <option value="1" selected="selected">1</option> <option value="2">2</option> <option value="3">3</option> </select> <select id="month" name="month" class="medium"> <option value="January" selected="selected">January</option> <option value="February">February</option> </select> <select id="year" name="year" class="medium"> <option value="2010" selected="selected">2010</option> <option value="2009">2009</option> <option value="2008">2008</option> </td></tr> <tr><td> <input type="Submit" value="Save"/> </td></tr> </table> </form> Similar TutorialsI am currently creating a form and I want to populate a drop down selection menu with data from two fields in a form. For example, I want it to pull the first and last name fields from a database to populate names in a drop down menu in a form. I want the form to submit to the email address of the person selected in the drop down. Is this possible to do? The email is already a field in the record of the person in the database. Can anyone give me some pointers or advice on how I should go about setting up the "Select" box drop down? I am not sure how to code it to do what I am wanting. Any links to relevant help would be appreciated too. Thanks in advance! Can someone please help me with an array problem i can not figure out. I need the array to be numbered from 1 to how ever many fields that are needed in the form and have a mysql field name and the title of the field also in the array. 1, "mysql_field_name", "Title of form field" 2, "", "" and so on then the form will be shown based on the array. I have the following draft code which I am working with. any suggestions on how i may do this array ? Code: [Select] <?php $options = array( '1'=> array('fieldtext'=>'option1', 'mysqlfield'=>'option1'), '2'=> array('fieldtext'=>'option2', 'mysqlfield'=>'option2'), '3'=> array('fieldtext'=>'option3', 'mysqlfield'=>'option3'), '4'=> array('fieldtext'=>'option4', 'mysqlfield'=>'option4'), ); // $options = array(1 => "option1", "option2", "option3", "option4"); // the line above works but i want to include the name of the mysql field as well. $userid = 1; ?> <div style="align: center; margin: 12px; font-family:Tahoma;"> <br><br><?php if ($_POST['Update'] != "Update") { // check if form submitted yet, if not get data from mysql. $res = db_query("SELECT * FROM `users` WHERE `userid` = '" . $userid . "'"); foreach($options as $key => $value) { $_POST[$key] = mysql_result($res, 0, $value); } $ok_to_update = "no"; } elseif ($_POST['Update'] == "Update") { // check if form submitted yet, if so get POST data. // error checking // foreach($options as $key => $value) { // $_POST[$i] = ""; // } $ok_to_update = "yes"; } if ($_POST['Update'] == "Update" && $ok_to_update == "yes") { // $res = db_query("INSERT INTO `users` () VALUES ()"); // add user details to database. ?><p><br><br><br>Thank you for updating</p><?php } else { ?><form name="form1" method="post" action=""> <?php foreach($options as $key => $value) { ?><p><?php echo($value); ?>: <input type="text" name="<?php echo($key); ?>" value="<?php echo($_POST[$key]);?>"></p> <?php } ?> <input name="Update" type="submit" value="Update"> </form> <?php } ?> </div> This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=326600.0 Hi, bit stuck on how to find and replace "<" and ">" with "<" and ">". I basically have a database record that outputs to screen and I need the code in the <code> tags to be rendered to the screen. I therefore need it to go through the whole array variable from the db and change the symbols just inside the code tags. Please be aware that the code tags might happen more than once here's an example below Code: [Select] <p>blah blah blah</p> <p>blah blah blah</p> <p>blah blah blah</p> <code> <h1>hello</h1> </code> <p>blah blah blah</p> <p>blah blah blah</p> <p>blah blah blah</p> <code> <h1>hello</h1> </code> the desired output would be: <p>blah blah blah</p> <p>blah blah blah</p> <p>blah blah blah</p> <code> <h1>hello</h1 </code> <p>blah blah blah</p> <p>blah blah blah</p> <p>blah blah blah</p> <code> <h1>hello</h1 </code> help on this would be great Cheers Rob Hi guys I am a newbie with PHP and I have been trying to solve this problem for 3 days.. Ive set up a booking form on my website to be sent directly to my email once the client clicked on the send button.. The problem I am having while checking these pages on wamp is that the booking form is ok but when I click on the send button the following message error appears "Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\fluffy_paws\booking_form2.php on line 27" When I check online I have this message "500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed." Are my codes wrong??? My webhosting is Blacknight.com , Im on Windows Vista, my internet is a dongle with O2 ireland Thanks for your help! Hi guys I'm struggling a bit, I need to replace a word that occurs multiple times in text with an array("up","down","forward","backwards") of words. $find = "left"; $replace = array("up","down","forward","backwards"); $text = "left left left left"; echo str_replace($find,$replace,$text); The Output is: array array array array Did try this with a foreach statement as well, but no luck. Is there a better way of doing this? Thanks cant work out this mysql syntax error "operation":"medupdate","medid":"","name":"ibo","medyear":"5","medmonth":"21","medday":"1","recuser":1,"SuccFail":"fail","SuccFailMessage":"error occured You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''WHERE med_id=' at line 2","ResultData":""} Code: [Select] $sql="update metodology set med_description='".$req['name']."', med_year='".$req['medyear']."', med_month='".$req['medmonth']."', med_day='".$req['medday']."', med_recorddate= now(), med_recorduserid= 1'"; $sql.= " WHERE med_id=".$req['medid']; I am getting the following error when using composer: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? Just started. I am pretty sure composer.json wasn't changed. journalctl doesn't show anything. Maybe Doctrine related, however, nothing seems to help.
Any ideas? [michael@devserver www]$ php -v PHP 7.3.4 (cli) (built: Apr 2 2019 13:48:50) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies with DBG v9.1.9, (C) 2000,2018, by Dmitri Dmitrienko [michael@devserver www]$ composer -V Composer version 1.4.2 2017-05-17 08:17:52 [michael@devserver www]$ yum info composer Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.us.oneandone.net * epel: mirror.rnet.missouri.edu * extras: mirror.us.oneandone.net * remi-php73: mirror.bebout.net * remi-safe: mirror.bebout.net * updates: mirror.us.oneandone.net Installed Packages Name : composer Arch : noarch Version : 1.8.4 Release : 1.el7 Size : 1.8 M Repo : installed From repo : epel Summary : Dependency Manager for PHP URL : https://getcomposer.org/ License : MIT Description : Composer helps you declare, manage and install dependencies of PHP projects, : ensuring you have the right stack everywhere. : : Documentation: https://getcomposer.org/doc/ [michael@devserver www]$ composer update Loading composer repositories with package information Updating dependencies (including require-dev) [ErrorException] "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]... [michael@devserver www]$
This topic has been moved to Linux. http://www.phpfreaks.com/forums/index.php?topic=318175.0 I am having problems being able to find the data that needs to be posted in various translation websites. I think this is because the translation tools they have are using some kind of flash script to translate? So the new page isn't being loaded using the post data string?? I am not completely sure, anyways... I am using live http headers on firefox to try and get the content for the post data string. The sites I have tried to get the post data from are these: http://www.freetranslation.com/ http://www.free-translator.com/ I can get cURL to visit the page and do everything, I just cant find the post data string. or maybe I am way off here.. Thanks for any help Hi People. I run the following airfield site http://www.microlight.co Now on each airfield card there is a google iframe image that is held in the database and shows OK on the page. Anyone got any idea how I can get a hold of the co-ordinate information for each card so that I can display it somewhere else on screen? Here is a typical image of the airfield I use. Code: [Select] <iframe width="700" height="700" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.google.co.uk/maps?ie=UTF8&t=h&ll=53.952058,-1.17631&spn=0.008839,0.014999&z=16&output=embed"></iframe><br /><small><a href="http://www.google.co.uk/maps?ie=UTF8&t=h&ll=53.952058,-1.17631&spn=0.008839,0.014999&z=16&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small> I have a text file that contain something like this : question.txt ------------------------ 12/10/2010 Quest : Was a web designer really care about your web security other than thinking so hard to design your web just based on how the web will looks like?. >>from:sombody@somwhere.com,opinion=not at all,comment:your site are cool 11/10/2010 Quest : Was a web designer really love his girl friend in other side they r almost got no time dating with her? >>from:sombody@somwhere.net,opinion=he loves computer,comment:your site are waste. ------------------------- All i need to do is, grabing all informations after the char ">>" and write it to another text file name "output.txt" that will contain : output.txt --------------------- from:sombody@somwhere.com,opinion=not at all,comment:your site are cool from:sombody@somwhere.net,opinion=he loves computer,comment:your site are waste. --------------------- can some one show me the way? thanks. Hi, i need to run this past you guy's. I need a way to effectivly check if a user has entered correct "real" details in my registeration form and check if email is already in my database to prevent the user from registering twice? I need this as some unknown person is using the form and entering there details like this: Username: 1 Password: 1 email: 1 It's really annoying as they are doing this several times so i have around 13 rows of just "1" in my table now! grr!! so far ive got: Form: <input name="upassword" type="password" class="style7" id="upassword"> <span class="style7">Email</span> <span class="style7">:</span> <input name="email" type="text" class="style7" id="email"> <span class="style7"></span> <span class="style7"></span> <input name="Submit" type="submit" class="style7" value="Register" /> </form> Script: Code: [Select] <?php if ($db_found) { $SQL = "INSERT INTO users (username, upassword, email) VALUES ('" .$username. "', '" .$upassword. "', '" .$email. "')"; $result = mysql_query($SQL); header( 'Location: http://www.removalspace.com/index.php' ); exit(); } else { print "Database NOT Found "; mysql_close($db_handle); } ?> But i need it to perform the checks aswell as drop the "real" data in to MySQL? Any ideas please? This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=347922.0 Hi, I currently have an if, elseif, else program that starts off with Code: [Select] if( $v_name == "" || $v_msg == "" ) echo "something" how do I turn this into a switch? but the very next elseif I have Code: [Select] elseif( strcspn( $_REQUEST['msg'], '0123456789' ) == strlen( $_REQUEST['msg'] ) ) echo "something" is it possible to turn this into a switch with 2 different strings like that to evaluate? I have a registration form on my website and after Registration I want the user to activate first his account. I don't have problem on sending this email to the user. What I want to appear is like this.. GoodDay "username", Blah Blah! how can you actually do that? I know that you can do that through session variables but the thing is email's can't accept scripts on sending emails. how can I get the value from a session variable for example and convert it to plain html text so that i can OUTPUT it to the email.. HELP PLEASE! <?php require_once('upper.php'); require_once('database.php'); echo $error_msg=''; if(isset($_POST['submit'])) { $LoginId=mysqli_real_escape_string($dbc,trim($_POST['LoginId'])); $Password1=mysqli_real_escape_string($dbc,trim($_POST['Password1'])); $Password2=mysqli_real_escape_string($dbc,trim($_POST['Password2'])); $Name=mysqli_real_escape_string($dbc,trim($_POST['Name'])); $Age=mysqli_real_escape_string($dbc,trim($_POST['Age'])); $BloodGroup=mysqli_real_escape_string($dbc,trim($_POST['BloodGroup'])); if(!isset($_POST['Sex'])) { echo 'Please enter Sex<br>'; } else{ $Sex= mysqli_real_escape_string($dbc,trim($_POST['Sex'])); } $Qualification=mysqli_real_escape_string($dbc,trim($_POST['Qualification'])); $ContactNumber=mysqli_real_escape_string($dbc,trim($_POST['ContactNumber'])); $Email=mysqli_real_escape_string($dbc,trim($_POST['Email'])); $Address=mysqli_real_escape_string($dbc,trim($_POST['Address'])); $AboutYourself=mysqli_real_escape_string($dbc,trim($_POST['AboutYourself'])); //$countCheck=count($_POST['checkbox']); //echo $countCheck; //$checkbox=$_POST['checkbox']; //$countCheck=count($checkbox); if(empty($LoginId)){echo 'Please enter Login Id';} elseif(empty($Password1)){echo 'Please enter Password';} elseif(empty($Password2)){echo 'Please confirm Password';} elseif($Password1!==$Password2){echo 'Password didn\'t match';} elseif(empty($Name)){echo 'Please enter Name';} elseif(empty($Age)){echo 'Please enter Age';} elseif(!isset($_POST['Sex'])){} elseif(empty($Qualification)){echo 'Please enter Qualification';} elseif(empty($ContactNumber)){echo 'Please enter Contact Number';} elseif(empty($Email)){echo 'Please enter Email';} elseif(empty($Address)){echo 'Please enter Address';} elseif(empty($AboutYourself)){echo 'Please enter About Yourself';} elseif(!isset($_POST['checkbox'])){ echo 'You have to register at least one activity.';} else { require_once('database.php'); $query="select * from registration where LoginId='$LoginId'"; $result=mysqli_query($dbc,$query); if(mysqli_num_rows($result)==0) { $checkbox=$_POST['checkbox']; $countCheck=count($_POST['checkbox']); $reg_id=' '; for($i=0;$i<$countCheck;$i++) { $reg_id=$reg_id.$checkbox[$i].','; } $query="insert into registration (LoginId,Password,Name,Age,BloodGroup,Sex,Qualification,ContactNumber,Email,Address,AboutYourself,Activity)values ('$LoginId',SHA('$Password1'),'$Name','$Age','$BloodGroup','$Sex','$Qualification','$ContactNumber','$Email','$Address','$AboutYourself',',$reg_id')"; $result=mysqli_query($dbc,$query) or die("Not Connect"); echo ' Dear '.$Name.'.<br>Your Account is waiting for approval<br>'; //header('Location: index.php'); // header('Location: Registration.php'); } else { echo 'Dear '.$Name. ', <br> An account already exist with login-id<b> '.$LoginId.'</b> <br>Please try another login-id'; }} } ?> <html> <body> <?php echo $error_msg; ?> <form action='<?php echo $_SERVER['PHP_SELF'];?>' method='post'> <div class="registration_and_activity"> <table border="0" width="400"> <tr><td colspan="2"> <h3>New User?</h3></td></tr> <tr><td width="120"> Enter Login id</td><td><input type='text' name='LoginId' value='<?php if(!empty($LoginId))echo $LoginId;?>' /></td></tr> <tr><td> Enter Password</td><td><input type='password' name='Password1' value='<?php if(!empty($Password1))echo $Password1;?>' /></td></tr> <tr><td> Confirm Password</td><td><input type='password' name='Password2' value='<?php if(!empty($Password2))echo $Password2;?>' /></td></tr> <tr><td> Enter Name</td> <td><input type='text' name='Name' value='<?php if(!empty($Name))echo $Name;?>' /></td></tr> <tr><td> Enter Age</td><HEAD> <SCRIPT language=Javascript> function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; } </SCRIPT> </HEAD> <td><INPUT onkeypress='return isNumberKey(event)' type='text' name='Age' value='<?php if(!empty($Age))echo $Age;?>'/></td></tr> <tr><td> Enter Blood</td><td><input type='text' name='BloodGroup'value='<?php if(!empty($BloodGroup))echo $BloodGroup;?>' /></td></tr> <tr><td> Enter Sex</td><td><input type='radio' name='Sex' style='width:16px; border:0;' 'value='Male' />Male <input type='radio' name='Sex' style='width:16px; border:0;' 'value='Female' />Female</td></tr> <tr><td> Enter Qualification</td><td><input type='text' name='Qualification' value='<?php if(!empty($Qualification))echo $Qualification;?>' /></td></tr> <tr><td> Enter Contact Number </td><td><input onkeypress='return isNumberKey(event)'type='text' name='ContactNumber' value='<?php if(!empty($ContactNumber))echo $ContactNumber;?>' /></td></tr> <tr><td> Enter Email</td><td><input type='text' name='Email' value='<?php if(!empty($Email))echo $Email;?>' /></td></tr> <tr><td> Enter Address</td><td><input type='text' name='Address' value='<?php if(!empty($Address))echo $Address;?>' /></td></tr> <tr><td> About Yourself :</td></tr> <tr><td colspan="2"><textarea rows='10' cols='40' name='AboutYourself' value='<?php if(!empty($AboutYourself))echo $AboutYourself;?>' /></textarea></td></tr> <tr><td> <?php echo" <tr><td colspan='2'><b>Select fields for which you want to register</b></td></tr>"; require_once('database.php'); $query="select * from activity"; $result=mysqli_query($dbc,$query); while($row=mysqli_fetch_array($result)){ $Title=$row['Title']; $ActivityId=$row['ActivityId']; echo "<tr><td>$Title</td>"; //echo $ActivityId; [B]echo "<td><input type='checkbox' name='checkbox[]' value=$Title [/B]style='width:14px; text-align:right;'/></td></tr>";//value=$ActivityId tells ActivityId variable extracts with name="checkbox" echo "<br/>"; } echo "<tr><td colspan='2' align='center'><input type='submit' value='Register' name='submit' style='background:url(./images/button_img2.png) no-repeat 10px 0px; width:100px; padding:3px 0 10px 0; color:#FEFBC4; border:0;'/></td></tr><br>"; echo " </td></tr></table> </div> </form> </body> </html>"; require_once('lower.php'); ?> In above code when $Title="Fire" or any single word, it inserts in database properly but when $Title="Terrist Attack" or any data more than one word it inserts only the first word "Terrist". I want to insert the whole "Terrist Attack " as it is in database......... What i should do??????????/ Plzzzzzzzzzzz help Anyone???????????? 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 Hi - i need help with the fourth column named "jobnr" it has to be the highest number first and lowest at the bottum of the tabel. I tried different variation like "mysql_query("SELECT * FROM tabel ORDER BY jobnr DESC")" but with no success. I attached a picture og the working script output Code: [Select] <html> <head> <meta http-equiv="Content-type" content="text/html; charset=UTF-8"/> </head> <style type="text/css"> .myclass { font-size: 8pt; font-face: Verdana; } </style> <body> <?php // Define variables $host="host"; // Host name $username="user"; // Mysql username $password="password"; // Mysql password $db_name="database"; // Database name $tbl_name="tabel"; // Table name // Connect to server and select databse mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // saetter db udtraek til UTF-8 endcoding mysql_set_charset('utf8'); // henter db data fra tabllen: jobpositons $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); // Define $color=1 $color="1"; echo '<table border=0" bordercolor="#f3f3f3" cellpadding="1" cellspacing="1">'; echo "<tr bgcolor='#00aeef'> <th>Jobtitel</th> <th>Sted</th> <th>Oprettet</th> <th>jobnr</th> </tr>"; // sortere sql db data og indsaetter i html tabel while($rows=mysql_fetch_array($result)) { // If $color==1 table row color = #ffffff if($color==1){ echo "<tr bgcolor='#ffffff'><td class='myclass'>".$rows['Jobtitel']."</td><td class='myclass'>".$rows['Sted']."</td><td class='myclass'>".$rows['oprettet']."</td><td class='myclass' align='right'>".$rows['jobnr']."</td> </tr>"; // Set $color==2, for switching to other color $color="2"; } // When $color not equal 1, use this table row color else { echo "<tr bgcolor='#f3f3f3'> <td class='myclass'>".$rows['Jobtitel']."</td><td class='myclass'>".$rows['Sted']."</td><td class='myclass'>".$rows['oprettet']."</td><td class='myclass' align='right'>".$rows['jobnr']."</td> </tr>"; // Set $color back to 1 $color="1"; } } echo '</table>'; mysql_close(); ?> </body> </html> I want to do an sql query, but I want it to happen only after my user has clicked on a confirmation link. The link will be sent to their email address. What is the usual procedure for this? For the time being Ive chucked what ive got into 1 php file, but I pressume I will need a couple of php files, and some how pass some variables from 1 page to the next??? $first = $_GET['first']; $last = $_GET['last']; $age = $_GET['age']; $$emailad = $_GET ['emailad'] $query =mysql_query ("INSERT INTO treesurgeons (FirstName, LastName, Age) VALUES ('$first', '$last', '$age')"); echo mysql_error(); echo "<p>Thankyou for submiting your details.\r\n Please check your inbox and click on your confirmation link.</p>"; $message = "The following details have been submited to the tree directory and are awaiting confirmation; $first $last, $age. \r\n Please click on the link below to confirm these details are correct"; //Do I include a link to an html file or php file? $subject = "Your tree directory details"; $to = "$email"; $email = "$emailad"; mail( "$to", "$subject","$message", "$headers"); //How do I trigger this email upon confirmation ?></body></html> |