close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Opening Profile page

Thread began 6/10/2011 12:31 am by jen425288 | Last modified 6/18/2011 11:42 am by jen425288 | 3092 views | 26 replies

tom92909Beta Tester

Ok. I decided to create a set of simple sample pages using ONLY Dreamweaver CS3. The following are what I came up with. I hope they help. :)


page1.php ( Find Record Form )

html:
<!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></title>
</head>
<body>
<form action="page2.php" method="post">
<table>
<tr>
<td nowrap="nowrap">Enter Email Address:</td>
<td>&nbsp;</td><td><input name="email" type="text" size="30" /></td>
<td>&nbsp;</td><td><input type="submit" value="Go" /></td>
</tr>
</table>
</form>
</body>
</html>



page2.php - ( Update Record )

php:
<?php require_once('../Connections/dbconnect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_update"])) && ($_POST["MM_update"] == "update")) {
  
$updateSQL sprintf("UPDATE users SET FirstName=%s, LastName=%s WHERE UserID=%s",
                       
GetSQLValueString($_POST['fname'], "text"),
                       
GetSQLValueString($_POST['lname'], "text"),
                       
GetSQLValueString($_POST['id'], "int"));

  
mysql_select_db($database_dbconnect$dbconnect);
  
$Result1 mysql_query($updateSQL$dbconnect) or die(mysql_error());

  
$updateGoTo "page1.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$updateGoTo .= (strpos($updateGoTo'?')) ? "&" "?";
    
$updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$updateGoTo));
}

$colname_getUsers "-1";
if (isset(
$_POST['email'])) {
  
$colname_getUsers = (get_magic_quotes_gpc()) ? $_POST['email'] : addslashes($_POST['email']);
}
mysql_select_db($database_dbconnect$dbconnect);
$query_getUsers sprintf("SELECT * FROM users WHERE UserEmail = %s"GetSQLValueString($colname_getUsers"text"));
$getUsers mysql_query($query_getUsers$dbconnect) or die(mysql_error());
$row_getUsers mysql_fetch_assoc($getUsers);
$totalRows_getUsers mysql_num_rows($getUsers);
?><!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></title>
</head>
<body>
<h3>Update User: <?php echo $row_getUsers['UserEmail']; ?></h3>
<hr />
<form  action="<?php echo $editFormAction?>" method="POST" name="update">
<table>
 <tr> 
  <td>First name:</td><td>&nbsp;</td><td><input name="fname" type="text" value="<?php echo $row_getUsers['FirstName']; ?>" size="30" /></td>
 </tr>
 <tr> 
  <td>Last name:</td><td>&nbsp;</td><td><input name="lname" type="text" value="<?php echo $row_getUsers['LastName']; ?>" size="30" /></td>
 </tr>
</table>

<table>
 <tr>
  <td><input type="submit" value="Save" />
    <input name="id" type="hidden" value="<?php echo $row_getUsers['UserID']; ?>" /></td>
 </tr>
</table>
<input type="hidden" name="MM_update" value="update" />
</form>
</body>
</html>
<?php
mysql_free_result
($getUsers);
?>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...