Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. Also I should ask, what kind of error are you getting? Does delete.php display "Error deleting account from database!"; are you getting a MySQL error; or something else?
  2. Assuming that you switch to the solution that kenrbnsn mentioned: <?php ... $delete = "<a href='delete.php?id=$id1'>Delete</a>"; ... ?> Do the delete links contain the ID? If so, what happens when you try to display $_GET['id'] on delete.php; does an ID get displayed?
  3. Also, the while loop is missing the end curly bracket after the print statement. Maybe it was accidentally left off when pasting into the forum. But you'll want to look into it if the change provided by kenrbnsn doesn't work.
  4. Note that the above code still has an extra echo that isn't needed. Also, I would imagine that $row->id is an invalid variable. Based on the code, kenrbnsn's solution should work though.
  5. I would imagine the mysqli_query needs to use the $sql variable and not $query: <?php ... $sql = "SELECT eventid FROM Registration WHERE eventid=".$_GET['eventid']." LIMIT 1"); $result = mysqli_query($dbcon, $sql) or die('error getting data'); ... ?>
  6. It looks like you're using two different variables for the event ID. I would imagine you need to use the $_GET version in the SQL query, unless you've define $eventid somewhere else in the script. <?php .. if (isset($_GET['eventid'])) { include('connect1.php'); $sql = mysql_query("SELECT * FROM Registration WHERE eventid='$eventid' LIMIT 1"); ... ?>
  7. It's amazing what a little semi-colon can do; or should I say what kind of havoc a missing semi-colon cause.
  8. Do you know if the ID is getting passed to registration.php? echo $_GET['eventid'] If it doesn't display anything, the bug is likely on the page that displays the form. My guess would be the input value for eventid isn't getting populated. If registration.php is getting the ID value, it might be helpful if you post the code that doesn't seem to work for registration.php.
  9. If you look at the source code for the HTML form, does the value attribute of "eventid" get set to the ID as expected? <input type='hidden' name='eventid' value='{$row['eventid']}'>
  10. For the code back in reply 25, it looks like you have an error: <?php ... $error = 'Passwords do not match.' . $errors[] = $error; ... ?> There should be a semi-colon after the line that assigns the value to $error instead of a period. If that's doesn't fix the issue, it might be helpful to post the most recent code.
  11. ...which can easily be circumvented. You should never validate client-side. You can find out the length of the string using strlen(). Make a condition that checks if string is greater than amount of chars you want to limit it by. You may want to consider using both maxlength and strlen(). Client-side validation can be circumvented, but that doesn't mean you should never use it. Client-side validation has it's place but I agree that you shouldn't depend on it.
  12. For reference, I think the blank page was caused by an extra curly bracket that snuck into the code. header( "Location: thankyou.php" );} //<--- sneaky curly bracket The exit() call was supposed to be inside that bracket. Of course in the end, the exit part isn't necessary since your redirecting the page to thankyou.php
  13. If I'm understanding the senerio properly, you should be able to use either. To update you basically would need to get the old count for the profile being viewed, update the count, and update the database. But you might be better off tracking all the views with insert. In addition to just getting the count, you could gather more information that may be useful down the road. For example, you could collect the date and/or time a profile was viewed which could be used to tell you how many people viewed the profile in the last month.
  14. The first issue is that the form needs to go below the error checking code. You should be able to move the entire PHP portion above the DOCTYPE.
  15. That might be helpful (posting the entire script; including the form). I'm just not seeing anything that would cause the issue.
  16. What happens if you type something into the "number" field and leave everything else blank?
  17. It's probably not causing the problem, but you'll want to be consistant with your variable names. Note that your getting the form information with the following: ... $name = $_REQUEST['name']; $number = $_REQUEST['number']; $profexp = $_REQUEST['profexp']; $nonprofexp = $_REQUEST['nonprofexp']; ... But later on, the code is using the $_POST version: ... if(trim($_POST['name']) == '') { ... I probably should have paid more attention when suggesting code earlier. Sorry for the confusion.
  18. If you leave the "number" field blank, does the corresponding if statement get executed? To see, try to print something inside the if statement: ... if(trim($_POST['number']) == '') { $errorIcon['number'] = 'Number is Required'; $errorFound = true; echo 'here - number is field blank'; } ... If the text gets displayed, the error variables should be set. So the next test would be to see if the variable contains data: ... if(trim($_POST['number']) == '') { $errorIcon['number'] = 'Number is Required'; $errorFound = true; } echo $errorIcon['number']; ... Do it display 'Number is Required'?
  19. No problem; let us know if you have any other questions.
  20. I probably shoud butt out since I haven't read the entire discussion, but should that be $errors? As I scan through previous posts, it seems like the variable is usually referred to with an "s" at the end. $errors[] = $errors;
  21. That code would be split up. The part that reads in the form data would be inside the first if that checks if the form was submitted and before running all the tests to make sure the fields aren't blank. The second part which sends out the e-mail and redirects to thankyou.php would go in the if statement which only gets executed if there weren't any errors right above the exit() function. <?php //INITIALIZE ERROR VARIABLES $errorFound = false; $errorIcon['name'] = ''; ... if (isset($_POST['submitbutton'])) { //GET FORM INFORMATION //<--- part one of your code $name = $_REQUEST['name']; $number = $_REQUEST['number']; $profexp = $_REQUEST['profexp']; $nonprofexp = $_REQUEST['nonprofexp']; //<--- end of part one //TEST FORM INFORMATION if(trim($_POST['name']) == '') { $errorIcon['name'] = 'Name is required'; $errorFound = true; } .... //IF NO ERRORS WERE FOUND, CONTINUE PROCESSING if (!$errorFound) { $headers = 'MIME-Version: 1.0' . "\r\n"; //<--- second part of your code $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: me@mydomain.co.uk' . "\r\n"; mail( "me@gmail.com", "Driving Lesson Enquiry", "Hi Chris,\n\n$name has requested information on lessons.\nPlease call them on $number.\n\nThey have had $profexp hours of profesional tutoring and $nonprofexp hours of practice" , $headers ); header( "Location: thankyou.php" );} //<--- end of second part exit(); // done } } //DISPLAY FORM ?> <form method="post" name="form1" action = ""> <INPUT name="submitbutton" type="submit" value="Submit" /> <label for="name">Name:</label> <input type="text" name="name" id="name" value="<?php print htmlentities($_POST['name']); ?>" /><?php echo $errorIcon['name']; ?> </form> Of course there is a lot more work to be done, but hopefully this gives you a better idea of how to use the code.
  22. Or the action attribute can be set to whatever the filename is: <form method="post" name="form1" action="book.php"> Taking what ocpaul20 provided for code, you can get the error icon next to the field by doing something like this: <?php //INITIALIZE ERROR VARIABLES $errorFound = false; $errorIcon['fname'] = ''; ... if (isset($_POST['submitbutton'])) { //TEST FORM INFORMATION if(trim($_POST['fname']) == '') { $errorIcon['fname'] = 'First name is required'; $errorFound = true; } .... //IF NO ERRORS WERE FOUND, CONTINUE PROCESSING if (!$errorFound) { ... exit(); // done } } //DISPLAY FORM ?> <form method="post" name="form1" action = ""> <INPUT name="submitbutton" type="submit" value="Submit" /> <label for="fname">First Name:</label> <input type="text" name="fname" id="fname" value="<?php print htmlentities($_POST['fname']); ?>" /><?php echo $errorIcon['fname']; ?> </form> Note that the code is untested, but it should get you started.
  23. For me, the easiest way is to process the form submission on the same page as the form. So instead of sending the form to "sendmail.php", change it to book.php. Then create an if statement which processes the form if it was submitted or it prepares to display the form if it hasn't.
  24. I think the issue is due to the margin-bottom declaration having an extra colon. margin-bottom:: 0px; Also, you could simplify the CSS with h1, h2, h3, h4, h5, h6, p { margin:0; padding:0; }
  25. You could utilize the code I posted earlier: substr($newPrice, 0, -1) Of course, you'll need to remove the decimal part first: $newPrice = (int)$newPrice; $newPrice = round($newPrice);
×
×
  • 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.