Jump to content

display message on form submit


searls03

Recommended Posts

how do I make it so that $message displays on form submit on the same page?:

<?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['id'])) { 
   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.php";
// Place Session variable 'id' into local variable
$userid = $_SESSION['id'];
?>
<?php
$message ='Registration has been verified!';
// Process the form if it is submitted
if ($_POST['submit']) {
$verified = $_POST['verified'];

  
$sql = mysql_query("UPDATE Events SET verified='yes',  WHERE barcode='$verified'");


exit();
} // close if post
?>
<?php
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM members WHERE userid='$userid'");
while($row = mysql_fetch_array($sql)){
$userid = $row["userid"];
$name = $row["name"];
$phone = $row["phone"];
$username = $row["username"];
$address = $row["address"];
$city = $row["city"];
$state = $row["state"];
$zip = $row["zip"];
$cell = $row["cell"];
$email = $row["email"];
$accounttype = $row["accounttype"];
$rank = $row["rank"];
$badges = $row["badges"];
$password = $row["password"];
$password2 = $row["password2"];
}
?>
<!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"><!-- InstanceBegin template="/Templates/template2.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<style type="text/css">

#editregion {
position:absolute;
left:-8px;
top:272px;
width:1293px;
height:51px;
z-index:1;
text-align: center;
clear: none;
float: none;
}

body {
background-image: url(file:///Macintosh HD/Users/aaron/Downloads/memberSystemBasic 4/button/boyscout1.png);
background-repeat: no-repeat;
position: relative;
}
#menu {
position:relative;
left:160px;
top:0px;
width:931px;
height:59px;
z-index:19;

}
#menu #MenuBar1 li a {
color: #000;
border-top-style: outset;
border-right-style: outset;
border-bottom-style: outset;
border-left-style: outset;
width: 100px;
}

#status {
position:relative;
left:16px;
top:180px;
width:124px;
height:44px;
z-index:14;
}


</style>
<script src="file:///Macintosh HD/Users/aaron/Downloads/memberSystemBasic 4/SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script type="text/javascript">
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];}}
}
</script>
<!-- InstanceBeginEditable name="head" -->


<style type="text/css">
body {
background-image: url(file:///Macintosh%20HD/Users/aaron/Downloads/memberSystemBasic%204/button/boyscout1.png);
background-repeat: no-repeat;
}
</style>
<!-- InstanceEndEditable -->
<!-- InstanceParam name="id" type="text" value="apDiv6" -->
<link href="file:///Macintosh HD/Users/aaron/Downloads/memberSystemBasic 4/SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#logout {
position:relative;
left:0px;
top:0pxpx;
width:134px;
height:38px;
z-index:20;
font-weight: bold;
font-size: 24px;
}
#logout a {
color: #000;
}


#status {
text-align: center;
}
#logout1 {
position:absolute;
left:1071px;
top:191px;
width:224px;
height:61px;
z-index:2;
}
#menu2 {
position:absolute;
left:-1px;
top:172px;
width:497px;
height:92px;
z-index:20;
}
#footer {
position:fixed;
left:-10px;
top:0px2
width:1290px;
height:63px;
z-index:1;
color: #000;
background-color: #000;
right: 0px;
bottom: 0px;
}
</style>
</head>
<body>
<div id="logout1"><div id="logout"><a href="file:///Macintosh HD/Users/aaron/Downloads/memberSystemBasic 4/logout.php">Logout</a></div></div>
<div id="status"><?php echo "$accounttype"; ?>
  <br /><?php echo "$name"; ?>
  <p> </p>
</div>
<div id="editregion"><!-- InstanceBeginEditable name="EditRegion3" -->
  <p> </p>
  <form id="form1" name="form1" method="post" action="">
    Please enter verification code:
    <label for="verified"></label>
<input type="text" name="verified" id="verified" />
  </form>
  <p>  </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
  <p> </p>
<!-- InstanceEndEditable --><br /><br />

<?php if ($accounttype == "Admin") {echo '<div id="footer"><img src="footer_admin.png" width="1290" height="63" border="0" usemap="#Map" />
  <map name="Map" id="Map">
    <area shape="rect" coords="10,5,112,32" href="myprofile.php" />
    <area shape="rect" coords="153,5,235,31" href="register.php" />
    <area shape="rect" coords="277,7,333,32" href="news.php" />
    <area shape="rect" coords="471,7,682,33" href="scoutmanager.php" />
    <area shape="rect" coords="726,5,874,34" href="membermanager.php" />
    <area shape="rect" coords="906,3,1058,34" href="eventmanager.php" />
    <area shape="rect" coords="1092,6,1226,32" href="newsmanager.php" />
  </map>
</div>'; } else if ($accounttyp="scout"){echo '<div id="footer"><img src="footer_scout.png" width="1290" height="63" border="0" usemap="#Map" />
  <map name="Map" id="Map">
    <area shape="rect" coords="526,6,632,34" href="myprofile.php" />
    <area shape="rect" coords="668,5,752,32" href="register.php" />
    <area shape="rect" coords="789,5,850,34" href="news.php" />
  </map>
</div>';} else {echo '<div id="footer"><img src="footer_admin.png" width="1290" height="63" border="0" usemap="#Map" />
  <map name="Map" id="Map">
    <area shape="rect" coords="10,5,112,32" href="myprofile.php" />
    <area shape="rect" coords="153,5,235,31" href="register.php" />
    <area shape="rect" coords="277,7,333,32" href="news.php" />
    <area shape="rect" coords="471,7,682,33" href="scoutmanager.php" />
    <area shape="rect" coords="726,5,874,34" href="membermanager.php" />
    <area shape="rect" coords="906,3,1058,34" href="eventmanager.php" />
    <area shape="rect" coords="1092,6,1226,32" href="newsmanager.php" />
  </map>
</div>'; }
?></div>



<div id="menu2"><div id="menu">
  <ul id="MenuBar1" class="MenuBarHorizontal">
    <li><a href="file:///Macintosh HD/Users/aaron/Downloads/memberSystemBasic 4/myprofile.php">My Profile</a>    </li>
    <li><a href="file:///Macintosh HD/Users/aaron/Downloads/memberSystemBasic 4/register.php">Register</a></li>
    <li><a href="file:///Macintosh HD/Users/aaron/Downloads/memberSystemBasic 4/projects.php">Projects</a>    </li>
    <li><a href="file:///Macintosh HD/Users/aaron/Downloads/memberSystemBasic 4/news.php">News</a></li>
    <?php if ($accounttype == "Admin") {
?>
    <li><a href="file:///Macintosh HD/Users/aaron/Downloads/memberSystemBasic 4/membermanager.php">Scout Manager</a></li>
    <li><a href="file:///Macintosh HD/Users/aaron/Downloads/memberSystemBasic 4/eventmanager.php">Event Manager</a></li>
    <li><a href="file:///Macintosh HD/Users/aaron/Downloads/memberSystemBasic 4/newsmanager.php">News Manager</a></li>
  </ul><?php
}
?>
</div></div>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>
<!-- InstanceEnd --></html>

Link to comment
https://forums.phpfreaks.com/topic/234102-display-message-on-form-submit/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.