Jump to content

searls03

Members
  • Posts

    907
  • Joined

  • Last visited

Everything posted by searls03

  1. I don't know if this will work, but try: <?php session_start(); if ($_SESSION['username']) echo "Welcome, ".$_SESSION['username']."! <br><a href='logout.php'>Logout!</a>"; else echo "<a href='register.php'>Register?</a>";\ echo " <form action=\"login.php\" method=\"post\"> Username: <input type=\"text\" name=\"username\"> <br> Password: <input type=\"password\" name=\"password\"> <br> <input type=\"submit\" value=\"Log in\"> </form> ?> again, I don't know if that is what you want, but it could be......
  2. here is a code I based it off of: <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ [url='http://www.flashbuilding.com/']www.flashbuilding.com[/url] -----------------------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 $id = $_SESSION['id']; // Process the form if it is submitted if ($_POST['username']) { $name = $_POST['name']; $phone = $_POST['phone']; $username = $_POST['username']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $cell = $_POST['cell']; $email = $_POST['email']; $sql = mysql_query("UPDATE members SET name='$name', phone='$phone', username='$username', address='$address', city='$city', state='$state', zip='$zip', cell='$cell', email='$email' WHERE id='$id'"); echo 'Your account info has been updated, visitors to your profile will now see the new info.<br /><br /> <meta HTTP-EQUIV="REFRESH" content="3; url=http://final.net46.net/myprofile.php">'; exit(); } // close if post ?> <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members WHERE id='$id' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $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"]; } ?> with a few modifications obviously, and that one works just fine.
  3. would help if we had code....but If you are going to "echo" a form like you echo if they are logged in....you would but a \before any " in the code as long as the echo is enclosed in ". Dont know if this helps, but hopefully it does!
  4. I use mysql and this code that I will show says that the info was sucessfully updated, but it wasnt. please help. By the way, I am designing a website for a boy scout troop that has asked me to help. any help appreciated: <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ [url=http://'http://www.flashbuilding.com/']www.flashbuilding.com[/url] -----------------------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 $id = $_SESSION['id']; // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members WHERE id='$id' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $rank = $row['rank']; } // Process the form if it is submitted if ($_POST['rank']) { $rank = $_POST['rank']; $sql = mysql_query("UPDATE members SET rank='$rank' where id='$id'"); echo 'Your account info has been updated, visitors to your profile will now see the new info.<br /><br /> <meta HTTP-EQUIV="REFRESH" content="3; url=http://final.net46.net/myprofile.php">'; exit(); } // 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> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="post" action="scout.php" onsubmit="return validate_form ( );"> <label for="rank"></label> <select name="rank" id="rank"> <option value="Scout">Scout</option> <option value="Tenderfoot">Tenderfoot</option> <option value="Second Class Scout">Second Class Scout</option> <option value="First Class Scout">First Class Scout</option> <option value="Star Scout">Star Scout</option> <option value="Life Scout">Life Scout</option> <option value="Eagle Scout">Eagle Scout</option> <option value="<?php echo $rank; ?>" selected="selected"></option> </select> <input type="submit" name="submit" id="submit" value="Save" /> </form> </body> </html>
×
×
  • 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.