Jump to content

Flowdy

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Everything posted by Flowdy

  1. Sorry here is the updated code <?php /* Has user submitted data? If not, display the registration form. */ if (! isset($_POST['submitbutton'])) { echo file_get_contents("/templates/register.html"); /* Form data has been submitted. */ } else { $conn = mysql_pconnect("localhost", "corpweb", "secret"); mysql_select_db("mygame"); /* Ensure that the password and password verifier match. */ if ($_POST['pswd'] != $_POST['pswdagain']) { echo "<p>The passwords do not match. Please go back and try again.</p>"; /* Passwords match, attempt to inster information into userauth table. */ } else { try { $_query ="INSERT INTO userauth (commonname, email, username, pswd) VALUES ('{$_POST['name']}', '{$_POST['email']}', '{$_POST['username']}','" . md5($_POST['pswd']) . "'"; $result = mysql_query($query); if (! $result) { throw new Exception( "Registration problems were encountered!" ); } else { echo "<p>Registration was sucessful!</p>; } } catch(Exception $e) { echo "<p>".$e->getMessage()."</p>"; } #endCatch } } ?>
  2. I changed that to that but im still getting the exact same error msg
  3. okies i changed that now i get this error when clicking submit
  4. This is the first time ive tried to code anything, A registration form...but it doesnt seem to work First the HTML <html> <head> <include ="registration.php"> <body> <form> <p>Name:<br> <input type="text" size="20"><br> <p>Email Address:<br> <input type="text" size="20"><br> <p>Username:<br> <input type="text" size="20"><br> <p>Password:<br> <input type="password" size="20"><br> <p>Verify Password:<br> <input type="password" size="20"><br> <br> <input type="Submit" value="Submit"> </form> </body> </html> now the PHP <?php /* Has user submitted data? If not, display the registration form. */ if (! isset($_POST['submitbutton'])) { echo file_get_contents("/templates/register.html"); /* Form data has been submitted. */ } else { $conn = mysql_pconnect("localhost", "corpweb", "secret"); mysql_select_db("mygame"); /* Ensure that the password and password verifier match. */ if ($_POST['pswd'] != $_POST['pswdagain']) { echo "<p>The passwords do not match. Please go back and try again.</p>"; /* Passwords match, attempt to inster information into userauth table. */ } else { try { $_query ="INSERT INTO userauth (commonname, email, username, pswd) VALUES ('$_POST[name]', '$_POST[email]', '$_POST[username]', md5('$_POST[pswd]')); $result = mysql_query($query); if (! $result) { throw new Exception( "Registration problems were encountered!" ); } else { echo "<p>Registration was sucessful!</p>; } } catch(Exception $e) { echo "<p>".$e->getMessage()."</p>"; } #endCatch } } ?> Thanx for any help given
  5. Hey guys! i was wondering what is the best way to learn PHP, a While ago i bought a book " Beginning PHP and MySQL 5 from novice to professional" i started to read it and give up as i didn't think i was learning anything even though i was so i put it away and i decided to get it out again today... but i doubt i will finish it i don't learn much from reading books as by the end of it i tend to forget what i learnt at the start but am determined to learn PHP! so what is the easiest and best way to learn? Thanx
  6. First off sorry if this is the wrong place... My question is when there is an error [b]Parse error: parse error in c:\program files\easyphp1-8\www\registration.php on line 24[/b] when you look for the line do you count all the lines including the ones with nothing on or just the ones with code on?
  7. I don't add nothing to the file when i try to use it, As with the [b]echo file_get_contents("C:\Program Files\EasyPHP1-8\www");[/b] I added after the www\registration.html
  8. My turn. Ok well My name is Michael am 6ft3 and am 18 live in England, in a small town called Jarrow, Which is situated on the North East Coast Near the city of Newcastle Upon Tyne. Ive only just started learning PHP and hope to get alot better as i continue to learn, learning PHP is just a hobby, As am a full time University Student, Doing my Degree in Photography studying in the Uni of Newcastle. I have made websites in the past but not every good ones as i don't know PHP yet so i only made them in HTML and CSS which i have only not long learnt which is another reason why i want to learn PHP.
  9. Am new to PHP and i decided to order a book as i knew VERY little about PHP and i mean very little, I looked at a number of books and i decided and ordered. Beginning PHP and MySQL 5 - From Novice to Professional. (second edition) by W. Jason Gilmore And i have learnt alot so far and am only on page 61 out of nearly 1000.
  10. I tired the code you posted but now is saying [b]Parse error: parse error in c:\program files\easyphp1-8\www\registration.php on line 19[/b] I was using my book as reference and in there it didnt have "submitbutton" it just had 'submitbutton'
  11. Thanx! i moved the " but the same error is still coming up  ??? I think am going to try rewrite the code I just looked in my book were i used reference for the code, It doesnt have the " at the end
  12. Thanx! I added the [color=red]"[/color] but am still getting the same error,
  13. I'm new to php and just reading a book learning how it works etc but i cant seem to figure whats wrong with this code. I keep getting [b]Parse error: parse error in c:\program files\easyphp1-8\www\registration.php on line 25[/b] This is my PHP Code [quote]<?php /* Has the user submitted data? If not, display the registration form. */ if (! isset($_POST['submitbutton'])) {     echo file_get_contents("C:\Program Files\EasyPHP1-8\www"); /* Form data has been submitted. */ } else {    $conn = mysql_pconnect("localhost", "corpweb", "secret");    mysql_select_db("corporate");   /* Ensure that the password and password verifier match. */   if ($_POST['pswd'] != $_POST['pswdagain']) {      echo "<p>The passwords do not match. Please go back and try again.</P>";   /* Passwords match, attempt to insert information into userauth table. */    } else {      try {         $query = "INSERT INTO userauth (commonname, email, username, pswd)                   VALUES ('$_POST[name]', '$_POST[email]',                   '$_POST[username]', md5('$_POST[pswd]'));         $result = mysql_query($query);         if (! $result) {            throw new Exception(                "Registration problems were encountered!"            );          } else {              echo "<p>Registration was successful!</P>";          }       } catch(Exception $e) {           echo "<p>".$e->getMessage()."</p>";       } #endCatch     }   } ?>[/quote] any my html code [code]<html> <body> <form method="post" action="registration.php"> Name:<br> <input type="text" name="name"> <br> Email Address:<br> <input type="text" name="email"> <br> Username:<br> <input type="text" name="username"> <br> Password:<br> <input type="password" name="password"> <br> Verify Password:<br> <input type="password" name="Vpassword"> <br> <br> <input type="submit" value="Register"> </form> </body> </html>[/code]
×
×
  • 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.