Jump to content

SalientAnimal

Members
  • Posts

    366
  • Joined

  • Last visited

Everything posted by SalientAnimal

  1. Thanks Lily, I would really appreciate that. I'm still quite new to PHP and everything I know is really self taught. I've tried doing a lot of reading up on the various things as and when I need them, but as you can imagine, one can only read so much before your head starts hurting. And reading code makes your head hurt even more as everyone seems to have a bit of a different coding style if I can call it that.
  2. I was about to get excited when I saw your reply Mikosiko, but when I removed the extra parenthesis I still get the same old error : Parse error: syntax error, unexpected 'if' (T_IF) in \submit_register.php on line 8
  3. I'm not sure I'm understanding what you asking, but the column in the table is set as VARCHAR. So it would be a word. The form is automatically selecting Active from the hidden field as the fields value is set to Active so that is the value that is being written to the table as well.
  4. The column in the database is called status. At the start of the form I have a hidden field name status and the value in this is set to Active. see the extract from the code below: <tr> <td><input type="hidden" name="status" align="left" valign="middle" value="Active"></td> </tr>
  5. Oh ok, here is the full code with the pages working together: <title> ? 2012 User Registration</title> <script type="text/javascript"> var count = 0; var delay = 250; var text = " 2012 User Registration "; function scroll () { document.title = text.substring(count, text.length) + text.substring (0, count) if (count < text.length) { count ++; } else { count = 1; } setTimeout ("scroll(1)", delay); } scroll(); </script> <LINK REL="SHORTCUT ICON" HREF="favicon.ico"> <script language = "Javascript"> function validateForm(form1) { if (document.form1.username.value == '') { alert('Please fill in your desired username'); return false; } if (document.form1.password.value == '') { alert('Please fill in your desired password!'); return false; } if (document.form1.verify_password.value == '') { alert('Please fill in your password again for confirmation!'); return false; } if (document.form1.password.value != document.form1.verify_password.value) { alert("The two passwords do not match! "+ "Please verify your password"); return false; } if (document.form1.fname.value == '') { alert('Please fill in your name!'); return false; } if (document.form1.lname.value == '') { alert('Please fill in surname!'); return false; } if (document.form1.sex.value == '') { alert('Please select your sex!'); return false; } } </script> <style type="text/css"> </style> </head> <link rel="stylesheet" type="text/css" href="css/layout_home.css"/> <body> <form id="form1" name="form1" method="post" action="submit/submit_register.php" onSubmit="return validateForm(form1);"> <table width="100%" border="0"> <tr> <td><strong> <!-- <h1 align="center">USER REGISTRATION</h1></strong></td>--> </tr> <tr> <td></td> <td> <br> <a class="tooltip" href="#">Why do we need all this information?<span class="custom info"> <img src="img\tooltips\info.png" alt="Information" height="48" width="48" /> <em>Information</em> This information is vital for us to keep all our systems up to date. It also allows us to gather information about you, should we need to get hold of someone in case of an emergency. <br><br> Please ensure that all information is captured accurately. </span> </a> </td> </tr> <tr> <td height="375"> </td> <td><table width="87%" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td><input type="hidden" name="status" align="left" valign="middle" value="Active"></td> </tr> <tr> <td width="29%" align="right" valign="left" ><strong>Username :</strong></td> <td><input type="text" name="username" align="left" valign="middle"></td> </tr> <tr> <td width="29%" align="right" valign="left" ><strong>Password :</strong></td> <td><input type="password" name="password" align="left" valign="middle"></td> </tr> <tr> <td width="29%" align="right" valign="left" ><strong>Verify Password :</strong></td> <td><input type="password" name="verify_password" align="left" valign="middle"></td> </tr> <tr> <td width="29%" align="right" valign="middle" ><strong>Title :</strong></td> <td width="71%" align="left" valign="middle"><select name="title" id="title"> <option value="">Select your Title</option> <option value="Miss">Miss</option> <option value="Mr">Mr</option> <option value="Mrs">Mrs</option> <option value="Ms">Ms</option> </select></td> </tr> <!-- FIELD --> <tr> <td width="34%" align="right" valign="middle" ><strong>Name :</strong></td> <td> <input id="element_1_1" name= "fname" class="element text" maxlength="70" value="" /> <input id="element_1_2" name= "lname" class="element text" maxlength="70" value="" /> </td> <tr> <td></td> <td>First Name Last Name </td> </tr> <!-- FIELD --> <tr> <td width="34%" align="right" valign="middle" ><strong>Race :</strong></td> <td width="71%" align="left" valign="middle"><select name="race" id="race"> <option value="">Select your Race</option> <option value="African">African</option> <option value="Asian">Asian</option> <option value="Coloured">Coloured</option> <option value="White">White</option> </select></td> </tr> <!-- FIELD --> <tr> <td width="34%" align="right" valign="middle" ><strong>Sex :</strong></td> <td width="71%" align="left" valign="middle"><select name="sex" id="sex"> <option value="">Select your Sex</option> <option value="Female">Female</option> <option value="Male">Male</option> </select></td> </tr> <tr> <td width="29%" align="right" valign="middle" ><strong>Account Manager :</strong></td> <td width="71%" align="left" valign="middle"><select name="account_manager" id="account_manager"> <option value="">Select your Account Manager</option> <option value="Account Managers">Account Managers</option> </select></td> </tr> <tr> <td width="29%" align="right" valign="middle" ><strong>Department :</strong></td> <td width="71%" align="left" valign="middle"><select name="department" id="department"> <option value="">Select your Department</option> <option value="List OfDepartments">List Of Departments</option> </select></td> </tr> <tr> <td width="29%" align="right" valign="middle" ><strong>Designation :</strong></td> <td width="71%" align="left" valign="middle"><select name="designation" id="designation"> <option value="">Select your Designation</option> <option value="Manager">Manager</option> <option value="Supervisor">Supervisor</option> </select></td> </tr> <tr> <td width="29%" align="right" valign="middle" ><strong>Direct Report :</strong></td> <td width="71%" align="left" valign="middle"><select name="direct_report" id="direct_report"> <option value="">Select your Direct Report</option> <option value="List Of Reports">List Of Reports</option> </select></td> </tr> <tr> <td width="29%" align="right" valign="left" ><strong>ID Number :</strong></td> <td><input type="text" name="id_number" align="left" valign="middle" maxlength="13"></td> </tr> <tr> <td width="29%" align="right" valign="left" ><strong>MSISDN :</strong></td> <td><input type="text" name="number" align="left" valign="middle" maxlength="10"></td> </tr> <tr> <td width="29%" align="right" valign="left" ><strong>Alternative MSISDN :</strong></td> <td><input type="text" name="alt_number" align="left" valign="middle" maxlength="10"></td> </tr> <tr> <td width="34%" align="right" valign="middle" ><strong>E-Mail Address :</strong></td> <td> <input id="element_2_1" name="email" class="element text" size="45" maxlength="70" value=""/> </td> </tr> <tr> <td width="29%" align="right" valign="left" ><strong>Domain :</strong></td> <td><input type="text" name="domain" align="left" valign="middle" maxlength="80"></td> </tr> <!-- FIELD --> <tr> <td width="34%" align="right" valign="middle" ><strong>Next Of Kin :</strong></td> <td> <input id="element_1_1" name= "kin_fname" class="element text" maxlength="70" value=""/> <input id="element_1_2" name= "kin_lname" class="element text" maxlength="70" value=""/> </td> <tr> <td></td> <td>First Name Last Name </td> </tr> <tr> <td width="29%" align="right" valign="left" ><strong>Next Of Kin MSISDN :</strong></td> <td><input type="text" name="next_of_kin_number" align="left" valign="middle" maxlength="10"></td> </tr> <tr> <td> <p> <input type="reset" value="Reset Form"> </p></td> <td> <p> <input type="Submit" value="⇒ Register"> </p></td> </tr> </table></td> </tr> </table> </form> </body> </html> This was one of my first forms I created, so I have to admit that the coding is terrible. But it all worked so I never bothered to fix it. And then the actual code writing to the database: <?php error_reporting(-1); ini_set( 'display_errors', 'On' ); [email] if((isset($_POST['status']) && ($_POST['status']) == 'Active') { //Connect to DB server $con = mysql_connect("localhost","root","PW") or die("Could not connect: ".mysql_error()); $db = mysql_select_db("DB", $con) or die("Could not select database: ".mysql_error()); $sql="INSERT INTO userinfo (username , password , title , champ , race , sex , account_manager , department , designation , direct_report , id_number , number , alt_number , email , domain , next_of_kin , next_of_kin_number , status ) VALUES ('$_POST[username]' , '$_POST[password]' , '$_POST[title]' , '$_POST[fname] $_POST[lname]' , '$_POST[race]' , '$_POST[sex]' , '$_POST[account_manager]' , '$_POST[department]' , '$_POST[designation]' , '$_POST[direct_report]' , '$_POST[id_number]' , '$_POST[number]' , '$_POST[alt_number]' , '$_POST[email]' , '$_POST[domain]' , '$_POST[kin_fname] $_POST[kin_lname]' , '$_POST[next_of_kin_number]' , '$_POST[status]' )"; //Execute query $result = mysql_query($sql); if($result) { //Create email variable $to = "$_POST[email]"; $subject = "Registration - $_POST[username]"; $message = " Hi $_POST[fname] Thank you for completing your registration on the Call Tracker. You have registered using the following details: Username: $_POST[username] Password: $_POST[password] Name & Surname: $_POST[fname] $_POST[lname] E-Mail: $_POST[email] Should any of this information be incorrect, please contact the administrator. Welcome Aboard"; //Send email mail($to, $subject, $message); echo "<b><font color='white' face='segoe ui' size='2' align='center'>Congratulations you are a registered!</b></font>"; include "redirect_register.html"; } else { echo "Error: ".mysql_error(); } } else { echo "Error: ".mysql_error(); } [/email] ?> And thats the form.
  6. I originally had the post script running without the e-mail function and it was working fine. I then decided to add in the mail option, and at the begining it was working fine, except for on the odd occasion the user would get the e-mail but the data wouldn't be written to the database. Now I'm sitting with the scenario where I have moved the mail function to the end and all these other errors are poping up.
  7. Which tag? I tried using the code in various ways: <?php error_reporting(-1); ini_set( 'display_errors', 'On' ); [email] if((isset($_POST['status']) && ($_POST['status']) == 'Active') { //REMAINDER OF CODE <?php error_reporting(-1); ini_set( 'display_errors', 'On' ); [email] if((isset($_POST["status"]) && ($_POST["status"]) == "Active") { //REMAINDER OF CODE both give the same errors, only difference is the ' ' as apposed to the " "
  8. I understand the headache you talking about. sadly even adding that gives no other errors still getting: Parse error: syntax error, unexpected 'if' (T_IF) in \submit_register.php on line 8 and nothing else. Here is the code exactly as I used it: <?php error_reporting(-1); ini_set( 'display_errors', 'On' ); [email] if((isset($_POST['status']) && ($_POST['status']) == "Active") { //REMAINDER OF CODE
  9. Sorry my bad, forgot to click the next at the bottom of the srceen and thought my update wasn't posting. Got this error now: Parse error: syntax error, unexpected 'if' (T_IF) in \submit_register.php on line 3
  10. Still getting the same error: Parse error: syntax error, unexpected '$status' (T_VARIABLE) in \submit_register.php on line 3
  11. Stil lthe same error as previously Parse error: syntax error, unexpected '$status' (T_VARIABLE) in \submit_register.php on line 3
  12. Ok so from I've read the errors are cause by a space or a missing bracket or something silly like that. I've checked and recheck but I can't see anything. Can anyone else see anything wrong, I will post the full code again below: <?php [email] $status = $_POST["status"]; if(isset($status) == "Active") { //Connect to DB server $con = mysql_connect("localhost","root","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); $sql="INSERT INTO userinfo (username , password , title , champ , race , sex , account_manager , department , designation , direct_report , id_number , number , alt_number , email , domain , next_of_kin , next_of_kin_number , status ) VALUES ('$_POST[username]' , '$_POST[password]' , '$_POST[title]' , '$_POST[fname] $_POST[lname]' , '$_POST[race]' , '$_POST[sex]' , '$_POST[account_manager]' , '$_POST[department]' , '$_POST[designation]' , '$_POST[direct_report]' , '$_POST[id_number]' , '$_POST[number]' , '$_POST[alt_number]' , '$_POST[email]' , '$_POST[domain]' , '$_POST[kin_fname] $_POST[kin_lname]' , '$_POST[next_of_kin_number]' , '$_POST[status]' )"; //Execute query if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } //Create email variable $to = "$_POST[email]"; $subject = "Registration - $_POST[username]"; $message = " Hi $_POST[fname] Thank you for completing your registration. You have registered using the following details: Username: $_POST[username] Password: $_POST[password] Name & Surname: $_POST[fname] $_POST[lname] E-Mail: $_POST[email] Should any of this information be incorrect, please contact the administrator. Welcome Aboard"; //Send email mail($to, $subject, $message); echo "<b><font color='white' face='segoe ui' size='2' align='center'>Congratulations you are a registered!</b></font>"; include "redirect_register.html"; } [/email] ?>
  13. These are the two errors I get when try the suggestions. Parse error: syntax error, unexpected 'if' (T_IF) in \submit_register.php on line 3 Parse error: syntax error, unexpected '$status' (T_VARIABLE) in \submit_register.php on line 3
  14. Hi there, tried that as well, then I get the parse error on the if
  15. Ok so I tried using the code adjustment you made, but I keep getting this error: Parse error: syntax error, unexpected '{' on line 3 I've tried removing the {. Also I had it after the first if as in your post, but that then gives me and error on the if statment. Here is what I have at the moment <?php [email] { if ($_POST['status'] == "Active") //Connect to DB server $con = mysql_connect("localhost","root","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } $sql="INSERT INTO userinfo (username , password , title , champ , race , sex , account_manager , department , designation , direct_report , id_number , number , alt_number , email , domain , next_of_kin , next_of_kin_number , status ) VALUES ('$_POST[username]' , '$_POST[password]' , '$_POST[title]' , '$_POST[fname] $_POST[lname]' , '$_POST[race]' , '$_POST[sex]' , '$_POST[account_manager]' , '$_POST[department]' , '$_POST[designation]' , '$_POST[direct_report]' , '$_POST[id_number]' , '$_POST[number]' , '$_POST[alt_number]' , '$_POST[email]' , '$_POST[domain]' , '$_POST[kin_fname] $_POST[kin_lname]' , '$_POST[next_of_kin_number]' , '$_POST[status]' )"; //Execute query if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } //Create email variable $to = "$_POST[email]"; $subject = "Registration - $_POST[username]"; $message = " Hi $_POST[fname] Thank you for completing your registration. You have registered using the following details: Username: $_POST[username] Password: $_POST[password] Name & Surname: $_POST[fname] $_POST[lname] E-Mail: $_POST[email] Should any of this information be incorrect, please contact the administrator. Welcome Aboard"; //Send email mail($to, $subject, $message); echo "<b><font color='white' face='segoe ui' size='2' align='center'>thank you for registeringb></font>"; include "redirect_register.html"; }[/email] mysql_close($con) ?>
  16. Thanks for the feedback guys. I obviously still have loads to learn and by using the information I get here I have already progressed a long way. I will test the solutions mentioned here. Thanks a lot guys.
  17. Hi Guys/Gals, I have a user registration form that uses the below code to create a new user account and to send off a confirmation e-mail, however, for some reason some users only receive the confirmation e-mail, but their account is never created on the database and therefore they can not log in. Can someone see what I am doing wrong? <?php $con = mysql_connect("localhost","root","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } if ( $_POST['status'] == "Active" ) { $to = "$_POST[email]"; $subject = "Registration - $_POST[username]"; $message = " Hi $_POST[fname] Thank you for completing your registration. You have registered using the following details: Username: $_POST[username] Password: $_POST[password] Name & Surname: $_POST[fname] $_POST[lname] E-Mail: $_POST[email] Extention: $_POST[mitel_extension] Should any of this information be incorrect, please contact the administrator. Welcome Aboard"; } mail($to, $subject, $message); mysql_select_db("database", $con); $sql="INSERT INTO userinfo (username , password , title , champ , race , sex , account_manager , department , designation , direct_report , id_number , number , alt_number , email , domain , extension , next_of_kin , next_of_kin_number , status ) VALUES ('$_POST[username]' , '$_POST[password]' , '$_POST[title]' , '$_POST[fname] $_POST[lname]' , '$_POST[race]' , '$_POST[sex]' , '$_POST[account_manager]' , '$_POST[department]' , '$_POST[designation]' , '$_POST[direct_report]' , '$_POST[id_number]' , '$_POST[number]' , '$_POST[alt_number]' , '$_POST[email]' , '$_POST[domain]' , '$_POST[extension]' , '$_POST[kin_fname] $_POST[kin_lname]' , '$_POST[next_of_kin_number]' , '$_POST[status]' )"; //$CatName = $rowCat["Name"]; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "<b><font color='white' face='segoe ui' size='2' align='center'>Congratulations you are registered!</b></font>"; include "redirect_register.html"; mysql_close($con) ?>
  18. Sorry I probably should of also mentioned that the code I posted is part of the SQL Query where I am doing a INSERT INTO VALUES ('$_POST ucfirst[fname] $_POST ucfirst[lname]') Hence why the code looks the way it does
  19. This is just part of my registration page. All I'm wanting to do with the information is Capitalise the first letter of their first name and last name, so when I do personalised mailers it will just look neater.
  20. Problem is I have no idea what was in it. It was part of the XAMPP installaiton.
  21. Hi All, I accidentally saved over the apache_pb.php file. Is this a vital file?
  22. I'm not sure if this will help, but try a query along the lines of SELECT * FROM Tablename1 , Tablename2 , Tablename3 WHERE Tablename1.field1 = Tablename2.field1 AND Tablename2.field1 = Tablename3.field1
  23. Hi All, My question is pretty basic, how do I use ucfirst when submitting a form to the Table? I have tried the following: ,'$_POST ucfirst[fname] $_POST ucfirst[lname]' And ,'$_POST [ucfirst(fname)] $_POST [ucfirst(lname)]' Thanks
  24. Ok, thanks. Sorry for the possibility of this question seeming dumn. But what is cron? My searchs show that it runs on Moodle, can I still run the installation even thoguh I have an XAMPP installtions running all the processes?
  25. How do I get it to send the notifications at the different Milestones?
×
×
  • 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.