Jump to content

ngreenwood6

Members
  • Posts

    1,356
  • Joined

  • Last visited

Everything posted by ngreenwood6

  1. Can you elaborate some more as to what you are trying to accomplish? Kind of confused as to what you are trying to do.
  2. Yeah, but it should validate them through the ones that are currently there correct? I know that it will change which is fine because they can keep guessing as they change. I would think that it would try to authenticate the form through the current values not the updated ones correct?
  3. I have this page: <?php $parents = array("Nick","Kristin","Mark","Missy"); $children = array("Peyton","Greddy","Abby","Will"); $random_parents = array_rand($parents); $random_children = array_rand($children); $parent = $parents[$random_parents]; $child = $children[$random_children]; echo "Is $parent the parent of $child?"; ?> <form method="post" action=""> <input type="checkbox" name="yes" value="yes">Yes <br> <input type="checkbox" name="no" value="no">No <br> <input type="submit" name="submit" value="submit"> </form> <? $yes = $_POST['yes']; $no = $_POST['no']; if($yes == yes) { if($child == Abby || $child == Will && $parent == Mark || $parent == Missy) { echo "That is correct"; } else if($child == Peyton || $child == Greddy && $parent == Nick || $parent == Kristin) { echo "That is correct"; } else { echo "You are wrong"; } } else if($no) { if($child == Abby || $child == Will && $parent == Nick || $parent == Kristin) { echo "That is correct"; } else if($child == Peyton || $child == Greddy && $parent == Mark || $parent == Missy) { echo "That is correct"; } else { echo "You are wrong"; } } else { echo "Please submit a guess"; } ?> In this page Mark and Missy are the Parents of Abby and Will and Nick and Kristin are the Parents of Peyton and Greddy. For some reason no matter what I submit yes or no it always says "That is correct". Does anyone see anything wrong with my logic. Also, if I don't submit anything (ex. coming to the page for the first time) it always says "please submit a guess". I want it to say that if no one submits anything and only then. Does anyone see anything wrong with this or have any suggestions?
  4. I have got it now and it works perfectly. I have modified it for my needs. Thank you for your help that was great.
  5. Darkwater that worked like a charm. Thanks for all of your help. Sorry I am not good with reading how stuff works better at looking at examples and modifying for my needs.
  6. dristate the code that you just gave me does not output anything on the page. my current code was at the top of the page.
  7. sorry posted that before I got to read yours. The point of this is to get a random value and if I do the $array['1'] it is always going to give me the first one instead of a random one. I want it to be random.
  8. Yeah the only problem with that is that the data is not held in a table for this specific instance. Any clues as to why it is showing the numbers instead of the actual values?
  9. in your process1.php file you will have something like this: <?php //this selects what is selected in the dropdown box $students = $_POST['students']; ?> Hope this helps.
  10. Its not giving me the error now but it is just giving me numbers instead of the actual values. Any help?
  11. First, I am new to arrays and am trying to figure them out. Please let me know if this is the correct format or if there is a better way: $array = ("first","second","third","fourth","fifth"); Second, I am trying to display one of these values randomly. I am using the following code but it is giving me this error "Warning: rand() expects exactly 2 parameters, 1 given in C:\wamp\www\random.php on line 5": <?php $array = ("first","second","third","fourth","fifth"); $random = rand($array); echo $random; ?> Any help is appreciated.
  12. Im sorry but I just don't get it. I have a page like this: <?php $host = "localhost"; $user = "user"; $pass = "pass"; $db = "db"; $connect = mysql_connect($host, $user, $pass); $select_db = mysql_select_db($db); $query = "SELECT * from table"; while($row = mysql_fetch_array($query)) { echo "$row<br><a href='edit.php'>edit</a><br>"; } ?> The problem is that it returns however many comments are in the database(i will not know how many there are). I do not have anything on the edit.php page yet because I do not know how to edit that specific comment because there will be 5 different ones if there are 5 in the database. Can someone please explain to me how I would accomplish what I am trying to accomplish? An example would work best. I just did this to show that I do have knowledge of php and mysql for those doubting.
  13. seriously no one has any suggestions?
  14. The reason that it is working now is because the ending > was not letting the <form> actually render. Meaning that because that > was missing there was no beginning of the form because it that that was part of the <p> tag. If this is solved please mark the topic as solved unless you have some further questions.
  15. Can you post the new code? Exactly how you have it so that I may see.
  16. Thanks just trying to help.
  17. One thing I noticed was right before the <form> tag there is not an ending > for the <p> tag. Is it right on your end if not fix it and let us know. Meant to say its right after the "right".
  18. Can anyone help me with this?
  19. I tried it basically like this: <form name="myForm" method="POST" action="exp.php"> Email Address: <INPUT TYPE="text" SIZE="20" name="user"> <BR> Password: <INPUT TYPE="password" SIZE="20" name="pass"><br/><br/> <input type="submit" value="Submit" name="B1" style="font-family: Arial; font-weight: bold"> <input type="reset" value="Reset" name="B2" style="font-family: Arial; font-weight: bold"> </form> and it redirected me to the exp.php page. Is it taking you there? if not try dumbing down the code like I did.
  20. Can you post what the exp.php file looks like so that we can see what is going on there?
  21. Do you get any errors? Does exp.php still exist?
  22. You will have to connect to the mysql database and pull that information. Once it is pulled from the database you can then assign it as a value in the form. Here is an example: <?php mysql_connect("localhost", "user", "password"); mysql_select_db("database"); $query = mysql_query("SELECT occupation from table"); $row = mysql_fetch_array($query); ?> <form name="form" action="post.php" method="post"> <input name="occupation" value="$row['occupation']"> </form> The value in the input name is where you show the value. This is just an example but does that help?
  23. You will have to connect to the mysql database and pull that information. Once it is pulled from the database you can then assign it as a value in the form. Here is an example: <?php mysql_connect("localhost", "user", "password"); mysql_select_db("database"); $query = mysql_query("SELECT occupation from table"); $row = mysql_fetch_array($query); ?> <form name="form" action="post.php" method="post"> <input name="occupation" value="$row['occupation'"> </form> This is just an example but does that help?
  24. Well I have the comments page and the database already set up. I can post the comments to a page and have them show up on another. The problem I have is trying to figure out how to edit or delete the comments. I have them in the database and can pull them onto the page. What I don't understand is how to select a certain comment and have it edit that specific one. Can you help me with this. An example is what I am looking for because I am a noob and am trying to learn. Thanks
  25. Hello, I am looking for a page where a user can submit comments. I want the comments to be editable and deletable if I am logged in as admin. Can someone give show me an example of how you would accomplish this? Thanks
×
×
  • 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.