Jump to content

hannah

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hannah's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm fairly new to php and mysql. I know how to create search forms that allows people to search a specific word or category from the database. But now i want to create something more advanced like www.aaa.com, where it has a departure time, arrival time search. Can this be done with PHP and mysql?
  2. OMFG I finally made it work! Thank you all for your responses. Huggiebear, yea I see ur point. I donno what the differences are. When i copied down the code the code provider did not show the form code so yea that was confusing. I cleared it up now. kenrbnsn, you were right, I learned that $HTTP_POST_VARS is not auto-global. $_POST works much better. However i did not understand how to apply what you've suggested. Anyways, here's the final code for anybody who wants to see it: changepass.php <?php include 'connect.php'; $user=$_POST['user']; $currentpass=$_POST['pass']; $pass1=$_POST['oldpass']; $pass2=$_POST['newpass']; if (empty($pass) || empty($pass1)) { echo('<p><center><b>please enter BOTH your old and new passwords</b></p>'); exit(); } elseif ($pass1 == $pass2) { $query="UPDATE memtb SET pass='$newpass' WHERE id='$user';"; $result =mysql_query($query); if ($result) echo mysql_affected_rows().' inserted into the DB'; exit(); } ?> changepass01.html <form action="passchange.php" method="post"> <fieldset><legend>Enter your information in the form below:</legend> <p><b>Login Name:</b> <input type="text" name="user" size="10" maxlength="20" /></p> <p><b>Current Password:</b> <input type="password" name="pass" size="20" maxlength="20" /></p> <p><b>New Password:</b> <input type="password" name="oldpass" size="20" maxlength="20" /></p> <p><b>Confirm New Password:</b> <input type="password" name="newpass" size="20" maxlength="20" /></p> </fieldset> <div align="center"><input type="submit" name="submit" value="Change My Password" /></div> </form> what frustrates me, as a newbie, is how i struggled so hard to get here, and it really could have been prevented had the code providers have been giving accurate information. Anyways, kudos to all you moderators and php geniuses. If i ever become as knowledgable as you guys, I'll be sure to give back. www.greatlakesboatingfederation.org  <--I'm the web design intern there. Just wanted to throw that out. Peace
  3. I am trying to create a form so users can change their passwords. Obviously i am not writing the code right. I've tried like 20 different methods I got from the internet and books but still doesn't work. My server has PHP 5.0 so I donno what the deal is. So this is called changepass.php which will be called after changepass01.html sends the form information there. <?php include 'connect.php'; $currentpass = $HTTP_POST_VARS['pass']; $oldpass = $HTTP_POST_VARS['oldpass']; $newpass = $HTTP_POST_VARS['newpass']; $user = $HTTP_POST_VARS['user']; if (empty($oldpass) || empty($newpass)) { echo('<p><center><b>please enter BOTH your old and new passwords</b></p>'); exit(); } elseif ($oldpass !== $currentpass) { echo('you entered an incorrect password, hit back to retry'); exit(); } elseif ($oldpass == $currentpass) { $query="UPDATE memtb SET pass='$newpass' WHERE id='$user';"; $result =mysql_query($query); if ($result) echo mysql_affected_rows().' inserted into the DB'; exit(); } ?> So what am I doing wrong? I found some people use $query = "SELECT id FROM memtb WHERE (id='".$user."')"; somethin like that where you use periods I donno I tried doing that.. but then it doesn't update. Please help! Thanks in advance :)
×
×
  • 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.