Jump to content

post to database


searls03

Recommended Posts

can anyone see why this form wont post to the database?  I cant seem to do it to save my life!!!!!!!

 

<form id="form2" name="form2" action="settings1.php"> <table width="299" border="0" cellspacing="3" cellpadding="0">
          <tr>
            <td width="117" scope="col">First Name:</td>
            <td width="194" scope="col"> <input name="first" type="text" id="first" value="<?php echo $first; ?>" /></td>
          </tr><tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td>Middle Name:<br />
              (optional)</td>
            <td><input name="middle3" type="text" id="middle3" value="<?php echo $middle; ?>" /></td>
          </tr><tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td>Last Name:</td>
            <td><input name="last" type="text" id="last" value="<?php echo $last; ?>" /></td>
          </tr><tr><td></td><td><input name="fullname" type="submit" class="fullname" value="Save Changes" id="fullname"/></td></tr>
</table></form>

 

<?php

// Process the form if it is submitted
if ($_POST['first']) {
$first1 = $_POST['first'];
$middle1 = $_POST['middle3'];
$last1 = $_POST['last'];
$name1 = "{$_POST['first']}{$_POST['last']}";


$sql = mysql_query("UPDATE sessions SET first='$first1', middle='$middle1', last='$last1', name='$name1' WHERE id='$userid'")or die(mysql_error());
$message ='Your Account info has been saved';
echo "<font color = 'red'>";
echo  $message;
echo "</font>";
} // close if post
?> 

Link to comment
Share on other sites

this is entire code for page so you can see that I connect to database and such:

<?php
session_start(); // Must start session first thing
/* 
Created By Adam Khoury @ www.flashbuilding.com 
-----------------------June 20, 2008----------------------- 
*/
// Here we run a login check
if (!isset($_SESSION['username'])) { 
   echo 'Please <a href="/login.php">log in</a> to access your account';
   exit(); 
}

//Connect to the database through our include 
include_once "connect_to_mysql_1.php";
// Place Session variable 'id' into local variable
$username1 = $_SESSION['username'];
?>
<?php
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT first, middle, last, username, email, question, answer, password FROM sessions WHERE username='$username1'");
while($row = mysql_fetch_array($sql)){
$userid = $row["userid"];
$first = $row["first"];
$middle = $row["middle"];
$last = $row["last"];
$username = $row["username"];
$email = $row["email"];
$question = $row["question"];
$answer = $row["answer"];
$password = $row["password"];
$userid1 = $row["id"];
}
?>
<?php

// Process the form if it is submitted
if ($_POST['first']) {
$first1 = $_POST['first'];
$middle1 = $_POST['middle3'];
$last1 = $_POST['last'];
$name1 = "{$_POST['first']}{$_POST['last']}";


$sql = mysql_query("UPDATE sessions SET first='$first1', middle='$middle1', last='$last1', name='$name1' WHERE id='$userid'")or die(mysql_error());
$message ='Your Account info has been saved';
echo "<font color = 'red'>";
echo  $message;
echo "</font>";
} // close if post
?> 
<!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>
<title></title>

<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="jquery.livequery.js"></script>
<link href="dependencies/screen.css" type="text/css" rel="stylesheet" />

<script src="jquery.elastic.js" type="text/javascript" charset="utf-8"></script>
<link href="css/screen.css" type="text/css" rel="stylesheet" />
<script src="jquery.watermarkinput.js" type="text/javascript"></script>
<script src="Spry-UI-1.7/includes/SpryDOMUtils.js" type="text/javascript"></script>
<script src="Spry-UI-1.7/includes/SpryDOMEffects.js" type="text/javascript"></script>
<script src="Spry-UI-1.7/includes/SpryWidget.js" type="text/javascript"></script>
<script src="Spry-UI-1.7/includes/SpryMenu.js" type="text/javascript"></script>
<script src="Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarKeyNavigationPlugin.js" type="text/javascript"></script>
<script src="Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarIEWorkaroundsPlugin.js" type="text/javascript"></script>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<script src="jquery-ui-1.7.2/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="jquery-ui-1.7.2/js/jquery-ui-1.7.2.min.js" type="text/javascript"></script>
<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" media="all" href="css/chat.css" />
<link type="text/css" rel="stylesheet" media="all" href="css/screen.css" /><link href="jquery-ui-1.7.2/css/base/ui.core.css" rel="stylesheet" type="text/css">
<link href="jquery-ui-1.7.2/css/base/ui.accordion.css" rel="stylesheet" type="text/css">
<link href="jquery-ui-1.7.2/css/base/ui.theme.css" rel="stylesheet" type="text/css">
<link href="jquery-ui-1.7.2/css/base/ui.images.css" rel="stylesheet" type="text/css">
<script type="text/javascript">

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>

<style type="text/css">
#apDiv1 {
position:absolute;
left:0px;
top:0px;
width:100%;
height:50px;
z-index:1;
background-color: #000;
padding: 0px;
text-align: left;
}
</style>
<link href="Spry-UI-1.7/css/Menu/basic/SpryMenuBasic.css" rel="stylesheet" type="text/css">
<style type="text/css">
/* BeginOAWidget_Instance_2141544: #MenuBar */
/* Settable values for skinning a Basic menu via presets. If presets are not sufficient, most skinning should be done in
these rules, with the exception of the images used for down or right pointing arrows, which are in the file SpryMenuBasic.css

 These assume the following widget classes for menu layout (set in a preset)
.MenuBar - Applies to all menubars - default is horizontal bar, all submenus are vertical - 2nd level subs and beyond are pull-right.
.MenuBarVertical - vertical main bar; all submenus are pull-right.

You can also pass in extra classnames to set your desired top level menu bar layout. Normally, these are set by using a preset. 
They only apply to horizontal menu bars:
	MenuBarLeftShrink - The menu bar will be horizontally 'shrinkwrapped' to be just large enough to hold its items, and left aligned
	MenuBarRightShrink - Just like MenuBarLeftShrink, but right aligned
	MenuBarFixedLeft - Fixed at a specified width set in the rule '.MenuBarFixedLeft', and left aligned.  
	MenuBarFixedCentered -  - Fixed at a specified width set in the rule '.MenuBarFixedCentered', 
					and centered in its parent container.
	MenuBarFullwidth - Grows to fill its parent container width.

In general, all rules specified in this file are prefixed by #MenuBar so they only apply to instances of the widget inserted along
with the rules. This permits use of multiple MenuBarBasic widgets on the same page with different layouts. Because of IE6 limitations,
there are a few rules where this was not possible. Those rules are so noted in comments.

*/

#MenuBar  {
background-color:#000000;	
font-family: Arial, Helvetica, sans-serif; /* Specify fonts on on MenuBar and subMenu MenuItemContainer, so MenuItemContainer,
											MenuItem, and MenuItemLabel
											at a given level all use same definition for ems.
											Note that this means the size is also inherited to child submenus, 
											so use caution in using relative sizes other than
											100% on submenu fonts. */
font-weight: normal;
font-size: 16px;
font-style: normal;
padding:0;	
border-color: #000000 #000000 #000000 #000000; 
border-width:0px;
border-style: none none none none;
}
/* Caution: because ID+class selectors do not work properly in IE6, but we want to restrict these rules to just this
widget instance, we have used string-concatenated classnames for our selectors for the layout type of the menubar 
in this section. These have very low specificity, so be careful not to accidentally override them. */

.MenuBar br { /* using just a class so it has same specificity as the ".MenuBarFixedCentered br" rule bleow */
display:none;
}
.MenuBarLeftShrink {
float: left; /* shrink to content, as well as float the MenuBar */
width: auto;
}
.MenuBarRightShrink {
float: right; /* shrink to content, as well as float the MenuBar */
width: auto;
}
.MenuBarFixedLeft {
float: left;
width: 80em;
}
.MenuBarFixedCentered {
float: none;
width: 80em;
margin-left:auto;
margin-right:auto;
}
.MenuBarFixedCentered br {
clear:both;
display:block;
}
.MenuBarFixedCentered .SubMenu br {
display:none;
}
.MenuBarFullwidth {
float: left;
width: 100%;
}

/* Top level menubar items - these actually apply to all items, and get overridden for 1st or successive level submenus */
#MenuBar  .MenuItemContainer {
padding: 0px 0px 0px 0px; 
margin: 0; 	/* Zero out margin  on the item containers. The MenuItem is the active hover area.
			For most items, we have to do top or bottom padding or borders only on the MenuItem 
			or a child so we keep the entire submenu tiled with items.
			Setting this to 0 avoids "dead spots" for hovering. */
}
#MenuBar  .MenuItem {
padding: 0px 24px 0px 0px; 
background-color:#000000;	
border-width:0px;
border-color: #cccccc #ffffff #cccccc #ffffff; 
border-style: none solid none solid;
}
#MenuBar  .MenuItemFirst {
border-style: none none none none;
}
#MenuBar .MenuItemLast {
border-style: none solid none none;
}

#MenuBar  .MenuItem  .MenuItemLabel{
text-align:center;
line-height:1.4em;
color:#ffffff;
background-color:#000000;
padding: 6px 15px 6px 39px;
width: 10em;
width:auto; 
}
.SpryIsIE6 #MenuBar  .MenuItem  .MenuItemLabel{
width:1em; /* Equivalent to min-width in modern browsers */
}

/* First level submenu items */
#MenuBar .SubMenu  .MenuItem {
font-family: Arial, Helvetica, sans-serif;
font-weight: normal;
font-size: 14px;
font-style: normal;
background-color:#ffffff;
padding:0px 2px 0px 0px;
border-width:0px;
border-color: #cccccc #cccccc #cccccc #cccccc; 
/* Border styles are overriden by first and last items */
border-style: solid solid none solid;
}
#MenuBar  .SubMenu .MenuItemFirst {
border-style: solid solid none solid;
}
#MenuBar  .SubMenu .MenuItemFirst .MenuItemLabel{
padding-top: 6px; 
}
#MenuBar .SubMenu .MenuItemLast {
border-style: solid solid solid solid;
}
#MenuBar .SubMenu .MenuItemLast .MenuItemLabel{
padding-bottom: 6px; 
}
#MenuBar .SubMenu .MenuItem .MenuItemLabel{
text-align:left;
line-height:1em;	
background-color:#ffffff;
color:#333333;
padding: 6px 12px 6px 5px; 
width: 7em;

}

/* Hover states for containers, items and labels */
#MenuBar .MenuItemHover {
background-color: #666666;
border-color: #cccccc #cccccc #cccccc #cccccc; 
}

#MenuBar .MenuItemWithSubMenu.MenuItemHover .MenuItemLabel{
background-color: #666666; /* consider exposing this prop separately*/
color: #ffffff;
}
#MenuBar .MenuItemHover .MenuItemLabel{
background-color: #666666;
color: #ffffff;
}
#MenuBar .SubMenu .MenuItemHover {
background-color: #666666; 
border-color: #666666 #cccccc #cccccc #cccccc; 
}

#MenuBar .SubMenu .MenuItemHover .MenuItemLabel{
background-color: #666666; 
color: #ffffff;
}
/* Submenu properties -- First level of submenus */
#MenuBar .SubMenuVisible {
background-color: #ffffff;
min-width:0%;  /* This keeps the menu from being skinnier than the parent MenuItemContainer - nice to have but not available on ie6 */
border-color: #ffffff #ffffff #ffffff #ffffff; 
border-width:0px;
border-style: none none none none;
}
#MenuBar.MenuBar .SubMenuVisible {/* For Horizontal menubar only */
top: 100%;	/* 100% is at the bottom of parent menuItemContainer */
left:0px; /* 'left' may need tuning depending upon borders or padding applied to menubar MenuItemContainer or MenuItem, 
				and your personal taste.
				0px will left align the dropdown with the content area of the MenuItemContainer. Assuming you keep the margins 0 
				on MenuItemContainer and MenuItem on the parent
				menubar, making this equal the sum of the MenuItemContainer & MenuItem padding-left will align 
				the dropdown with the left of the menu item label.*/
z-index:10;
}
#MenuBar.MenuBarVertical .SubMenuVisible {
top: 0px;	
left:100%;
min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse */
}
/* Submenu properties -- Second level submenu and beyond - these are visible descendents of .MenuLevel1 */
#MenuBar .MenuLevel1 .SubMenuVisible {
background-color: #ffffff;
min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse*/
top: 0px;	/* If desired, you can move this down a smidge to separate top item''s submenu from menubar - 
			that is really only needed for submenu on first item of MenuLevel1, or you can make it negative to make submenu more
			vertically 'centered' on its invoking item */
left:100%; /* If you want to shift the submenu left to partially cover its invoking item, you can add a margin-left with a 
			negative value to this rule. Alternatively, if you use fixed-width items, you can change this left value
			to use px or ems to get the offset you want. */
}
/* IE6 rules - you can delete these if you do not want to support IE6 */

/* A note about multiple classes in IE6.
* Some of the rules above use multiple class names on an element for selection, such as "hover" (MenuItemHover) and "has a subMenu" (MenuItemWithSubMenu),
* giving the selector '.MenuItemWithSubMenu.MenuItemHover'.
* Unfortunately IE6 does not support using mutiple classnames in a selector for an element. For a selector such as '.foo.bar.baz', IE6 ignores
* all but the final classname (here, '.baz'), and sets the specificity accordingly, counting just one of those classs as significant. To get around this 
* problem, we use the plugin in SpryMenuBarIEWorkaroundsPlugin.js to generate compound classnames for IE6, such as 'MenuItemWithSubMenuHover'. 
* Since there are a lot of these needed, the plugin does not generate the extra classes for modern browsers, and we use the CSS2 style mutltiple class
* syntax for that. Since IE6 both applies rules where 
* it should not, and gets the specificity wrong too, we have to order rules carefully, so the rule misapplied in IE6 can be overridden. 
* So, we put the multiple class rule first. IE6 will mistakenly apply this rule.  We follow this with the single-class rule that it would 
* mistakenly override, making sure the  misinterpreted IE6 specificity is the same as the single-class selector, so the latter wins. 
* We then create a copy of the multiple class rule, adding a '.SpryIsIE6' class as context, and making sure the specificity for
* the selector is high enough to beat the single-class rule in the "both classes match" case. We place the IE6 rule at the end of the 
* css style block to make it easy to delete if you want to drop IE6 support.
* If you decide you do not need IE6 support, you can get rid of these, as well as the inclusion of the SpryMenuBarIEWorkaroundsPlugin.js script.
* The 'SpryIsIE6' class is placed on the HTML element by  the script in SpryMenuBarIEWorkaroundsPlugin.js if the browser is Internet Explorer 6. This avoids the necessity of IE conditional comments for these rules.
*/
.SpryIsIE6 #MenuBar .MenuBarView .MenuItemWithSubMenuHover .MenuItemLabel /* IE6 selector  */{
background-color: #666666; /* consider exposing this prop separately*/
color: #ffffff;
}
.SpryIsIE6 #MenuBar .MenuBarView .SubMenu .MenuItemWithSubMenuHover .MenuItemLabel/* IE6 selector  */{
background-color: #666666; /* consider exposing this prop separately*/
color: #ffffff;
}
.SpryIsIE6 #MenuBar .SubMenu .SubMenu  /* IE6 selector  */{
margin-left: -0px; /* Compensates for at least part of an IE6 "double padding" version of the "double margin" bug */
}

#online {
position:absolute;
left:12px;
top:114px;
width:102px;
height:124px;
z-index:10;
}	
/* EndOAWidget_Instance_2141544 */
#online {
text-align: left;
}
#menu {
position:absolute;
top:15px;
width:411px;
height:34px;
z-index:41;
right: 0px;
}
#apDiv2 {
position:absolute;
left:4px;
top:149px;
width:551px;
height:201px;
z-index:2;
}
#apDiv2 #Accordion1 .AccordionPanel.AccordionPanelClosed .AccordionPanelTab strong {
font-size: 14px;
}
</style>
<link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css">
<style type="text/css">
#apDiv3 {
position:absolute;
left:117px;
top:197px;
width:403px;
height:96px;
z-index:3;
}
#apDiv2 #TabbedPanels1 .TabbedPanelsContentGroup .TabbedPanelsContent.TabbedPanelsContentVisible #Accordion1 .AccordionPanel.AccordionPanelOpen .AccordionPanelContent #apDiv3 form p label {
text-align: left;
}
#apDiv4 {
position:absolute;
left:79px;
top:14px;
width:145px;
height:120px;
z-index:3;
}
#apDiv5 {
position:absolute;
left:-181px;
top:-118px;
width:69px;
height:17px;
z-index:3;
}
#apDiv6 {
position:absolute;
left:-105px;
top:-119px;
width:131px;
height:20px;
z-index:4;
}
#apDiv7 {
position:absolute;
left:-179px;
top:-89px;
width:92px;
height:21px;
z-index:3;
}
#apDiv8 {
position:absolute;
left:-85px;
top:-73px;
width:125px;
height:33px;
z-index:3;
}
#apDiv9 {
position:absolute;
left:28px;
top:12px;
width:68px;
height:23px;
z-index:0;
text-align: right;
}
#apDiv10 {
position:absolute;
left:6px;
top:43px;
width:90px;
height:22px;
z-index:0;
text-align: right;
}
#apDiv11 {
position:absolute;
left:31px;
top:82px;
width:66px;
height:26px;
z-index:0;
text-align: right;
}
#apDiv12 {
position:absolute;
left:102px;
top:10px;
width:80px;
height:27px;
z-index:0;
}
#apDiv13 {
position:absolute;
left:103px;
top:48px;
width:115px;
height:37px;
z-index:0;
}
#apDiv14 {
position:absolute;
left:103px;
top:81px;
width:124px;
height:35px;
z-index:0;
}
#hi {
background-color:#F7F7F7;
z-index:4;
}
.kljjkl {
color: #999;
}
</style>
<style type="text/css">
#apDiv15 {
position:absolute;
left:0px;
top:47px;
width:552px;
height:155px;
z-index:3;
background-color:#F7F7F7;
}
#apDiv16 {
position:absolute;
left:93px;
top:149px;
width:579px;
z-index:2;
height: 100%;
}
#apDiv17 {
position:absolute;
left:156px;
top:178px;
width:137px;
height:16px;
z-index:3;
}
#help {
position:absolute;
left:50px;
top:37px;
width:137px;
height:16px;
z-index:3;
text-align: right;
}#help1 {
position:absolute;
left:388px;
top:30px;
width:137px;
height:16px;
z-index:3;
text-align: right;
}
#middle {
position:absolute;
left:50px;
top:67px;
width:137px;
height:16px;
z-index:3;
text-align: right;
}
#apDiv18 {
position:absolute;
left:411px;
top:85px;
width:192px;
height:29px;
z-index:3;
}

#apDiv19 {
position:absolute;
left:50px;
top:100px;
width:137px;
height:30px;
z-index:3;
text-align: right;
}
#apDiv20 {
position:absolute;
left:355px;
top:110px;
width:182px;
height:27px;
z-index:3;
}
#bod {
position:absolute;
left:0px;
top:0px;
width:100%;
z-index:3;
bottom: 0px;
height: auto;
right: 0px;
}
#apDiv16 #TabbedPanels1 .TabbedPanelsContentGroup .TabbedPanelsContent.TabbedPanelsContentVisible table tr td {
text-align: right;
}
</style>
<link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#apDiv21 {
position:relative;
left:-20%;
width:200%;
height:75px;
z-index:3;
bottom: 0%;
right: 0px;
}
#apDiv22 {
position:absolute;
left:0px;
width:100%;
height:66px;
z-index:4;
bottom: 0px;
}
.fullname {
position:relative;
left:0px;
width:100px;
height:30px;
z-index:4;
top:25px;
background-color:black;
color:white;
text-align: center;
}
.fullname1 {
position:relative;
width:100px;
height:30px;
z-index:4;
top:30px;
background-color:black;
color:white;
left:-30px;
}
#apDiv16 #TabbedPanels1 .TabbedPanelsContentGroup .TabbedPanelsContent.TabbedPanelsContentVisible #CollapsiblePanel2 #CollapsiblePanel3 {
}
</style>
</head>

<body onload="MM_preloadImages('hover.png')">

<div id="apDiv1">
  <div id="menu">
    <ul id="MenuBar" class="MenuBarHorizontal">
  <li><a href="index.php">Home</a>  </li>
  <li><a href="profile.php">Profile</a></li>
  <li><a class="MenuBarItemSubmenu" href="#">Account</a>
    <ul>
      <li><a href="settings.php">Account Settings</a>      </li>
      <li><a href="privacy.php">Privacy Settings</a></li>
      <li><a href="logout.php">Logout</a></li>
    </ul>
  </li>
</ul>
    <script type="text/javascript">
// BeginOAWidget_Instance_2141544: #MenuBar
var MenuBar = new Spry.Widget.MenuBar2("#MenuBar", {
      widgetID: "MenuBar",
  widgetClass: "MenuBar  MenuBarRightShrink",
  insertMenuBarBreak: true,
      mainMenuShowDelay: 100,
      mainMenuHideDelay: 200,
      subMenuShowDelay: 200,
      subMenuHideDelay: 200
      });
// EndOAWidget_Instance_2141544
  </script></div>
<a href="main.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','hover.png',1)"><img src="main.png" name="Image1" width="600" height="50" border="0" id="Image1" /></a> </div>
<!-- Accordion --> <?php
// Process the form if it is submitted
if ($_POST['usernamebut']) {
$username = $_POST['username'];



$sql = mysql_query("UPDATE sessions SET username='$username' WHERE id='$userid'")or die(mysql_error());
$message ='Your Account info has been saved';
echo "<font color = 'red'>";
echo  $message;
echo "</font>";
} // close if post
?>
<?php
// Process the form if it is submitted
if ($_POST['emailbut']) {
$email = $_POST['email'];



$sql = mysql_query("UPDATE sessions SET email='$email' WHERE id='$userid'")or die(mysql_error());
$message ='Your Account info has been saved';
echo "<font color = 'red'>";
echo  $message;
echo "</font>";
} // close if post
?>
<?php
// Process the form if it is submitted
$password1 = $_POST['password'];
$password123 = md5($password1);
if ($_POST['passbut']) {
if ($password123 == $password) { 
$password12 = $_POST['password'];





$sql = mysql_query("UPDATE sessions SET password='$password12' WHERE id='$userid'")or die(mysql_error());
$message ='Your Account info has been saved';
echo "<font color = 'red'>";
echo  $message;
echo "</font>";
}} // close if post
?>


<div id="apDiv16">
  <div id="TabbedPanels1" class="TabbedPanels">
    <ul class="TabbedPanelsTabGroup">
      <li class="TabbedPanelsTab" tabindex="0">Settings</li>
      <li class="TabbedPanelsTab" tabindex="0">Notifications</li>
</ul>
    <div class="TabbedPanelsContentGroup">
      <div class="TabbedPanelsContent">
          <tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td></td>
            <td><label for="email"></label></td>
          </tr>
          <tr>
            <td></td>
            <td><label for="username"></label></td>
          </tr>
          <tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td> </td>
            <td> </td>
          </tr>
        <div id="CollapsiblePanel1" class="CollapsiblePanel">
          <div class="CollapsiblePanelTab" tabindex="0"><strong>Name</strong>
            <hr><font size="2px" color="#666666">Your real name</font>
            <br />
            <br />
            <br />
            <br />
          </div>
          <div class="CollapsiblePanelContent">       <form id="form2" name="form2" action="settings1.php"> <table width="299" border="0" cellspacing="3" cellpadding="0">
          <tr>
            <td width="117" scope="col">First Name:</td>
            <td width="194" scope="col"> <input name="first" type="text" id="first" value="<?php echo $first; ?>" /></td>
          </tr><tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td>Middle Name:<br />
              (optional)</td>
            <td><input name="middle3" type="text" id="middle3" value="<?php echo $middle; ?>" /></td>
          </tr><tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td>Last Name:</td>
            <td><input name="last" type="text" id="last" value="<?php echo $last; ?>" /></td>
          </tr><tr><td></td><td><input name="fullname" type="submit" class="fullname" value="Save Changes" id="fullname"/></td></tr>
</table></form>
            <br />
            <br />
          </div>
        </div>
        <div id="CollapsiblePanel2" class="CollapsiblePanel">
          <div class="CollapsiblePanelTab" tabindex="0"><strong>Username</strong>
            <hr /><font size="2px" color="#666666">Your Username</font>
            <br />
            <br />
            <br />
            <br />
          </div>
          <div class="CollapsiblePanelContent">
            
            <form method="post" action="settings.php">
  Username:
  <input name="username" type="text" id="username" value="<?php echo $username; ?>" />
           
          <input name="usernamebut" type="submit" class="fullname1" value="Save username" id="usernamebut"/></form>
            <p>  </p>
            <p> </p>
          </div>
          <div id="CollapsiblePanel3" class="CollapsiblePanel">
            <div class="CollapsiblePanelTab" tabindex="0"><strong>Email</strong>
              <hr /><font size="2px" color="#666666">Contact Information</font><br />
              <br />
              <br />
              <br />
            </div>
            <div class="CollapsiblePanelContent"><form action="settings.php" method="post">
              Email Address:
              <input name="email" type="text" id="email" value="<?php echo $email; ?>" /><input name="emailbut" type="submit" class="fullname1" value="Save email" id="emailbut"/></form>
            </div><br /><br />
            <div id="CollapsiblePanel4" class="CollapsiblePanel">
              <div class="CollapsiblePanelTab" tabindex="0"><strong>Password</strong>
                <hr />
              <font size="2px" color="#666666">Your Password</font><br />
              <br />
              <br />
              <br />
              <br />
              </div>
              <div class="CollapsiblePanelContent"><form action="settings.php" method="post"><table width="371" border="0" cellspacing="2" cellpadding="0">
          <tr>
            <td width="109" height="29" scope="col">Old Password:</td>
            <td width="242" scope="col"><label for="password"></label>
              <div align="left">
                <input name="password" type="text" id="password" />
              </div></td>
          </tr>
          <tr>
            <td>New Password:</td>
            <td><label for="new"></label>
              <div align="left">
                <input type="text" name="new" id="new" />
              </div>
              <label for="security"></label></td>
          </tr>
          <tr>
            <td>Confirm Password:</td>
            <td><label for="confirm"></label>
              <div align="left">
                <input type="text" name="confirm" id="confirm" />
              </div>
              <label for="answer"></label></td>
          </tr></table><input name="passbut" type="submit" class="fullname" value="Save Password" id="passbut"/>
          <br />
          <br />
              </form>
                <br />
                <br />
              </div>
              <div id="CollapsiblePanel5" class="CollapsiblePanel">
                <div class="CollapsiblePanelTab" tabindex="0"><strong>Security Question</strong>
                  <hr /><font size="2px" color="#666666">Used if you forget your password or username</font>
                  <br />
                  <br />
                  <br />
                  <br />
                </div>
                <div class="CollapsiblePanelContent"><form action="settings.php" method="post"><table>
                <tr>
            <td>Security Question:</td>
            <td><select name="security" size="1" id="security">
              <option value="What city were you born in?">What city were you born in?</option>
              <option value="What is your mother's maiden name?">What is your mother's maiden name?</option>
              <option value="What is the name of your first pet?">What is the name of your first pet?</option>
              <option value="What school did you go to?">What school did you go to?</option>
              <option value="<?php echo $question; ?>" selected="selected"><?php echo $question; ?></option>
            </select></td>
          </tr>
          <tr>
            <td>Answer:</td>
            <td><div align="left">
              <input name="answer" type="text" id="answer" value="<?php echo $answer; ?>" />
            </div></td>
          </tr>
          <tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td> </td>
            <td> </td>
          </tr>
        </table><input name="securitybut" type="submit" class="fullname" value="Save Question" id="securitybut"/>
        <br />
        <br />
        <br />
        <br />
                </form></div>
              </div>
            </div>
          </div>
        </div>
      </div>
      
      <div class="TabbedPanelsContent">
        
      </div>
</div>
    <form id="form1" name="form1" method="post" action="">
      <br />
      <br />
      <br />
      <br />
      <?php echo $first; ?><br />
<br />
      <br />
      <br />
    </form>
  </div>
</div>
<br /><br /><br /><br />
<script type="text/javascript">
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1", {contentIsOpen:false, enableAnimation:false});
var CollapsiblePanel2 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel2", {contentIsOpen:false, enableAnimation:false});
var CollapsiblePanel3 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel3", {contentIsOpen:false, enableAnimation:false});
var CollapsiblePanel4 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel4", {contentIsOpen:false, enableAnimation:false});
</script><br /><br /><br /><br /><br /><br />
<script type="text/javascript">
var CollapsiblePanel5 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel5", {contentIsOpen:false, enableAnimation:false});
</script>
</body>

</html>

Link to comment
Share on other sites

are you certain that the if condition is being met?

I would imagin that you would want to check if the submit button has been clicked first

 

if (isset($_POST['fullname'])) {
        if(!empty($_POST['first']) && !empty($_POST['middle3] && !empty($_POST['last']))){
            //act accordingly
        }
}

Link to comment
Share on other sites

Hello,

 

I'm pretty new at this, so please correct me if I'm wrong but:

 

<form id="form2" name="form2" action="settings1.php"> <table width="299" border="0" cellspacing="3" cellpadding="0">

 

Shouldn't this example from the first code snippet given contain; method="POST"?

 

edit: changed action to method :(

Link to comment
Share on other sites

Hello,

 

I'm pretty new at this, so please correct me if I'm wrong but:

 

<form id="form2" name="form2" action="settings1.php"> <table width="299" border="0" cellspacing="3" cellpadding="0">

 

Shouldn't this example from the first code snippet given contain; method="POST"?

 

edit: changed action to method :(

yes you're absolutely correct, i missed that in my scan of the code

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.