Jump to content

CyberShot

Members
  • Posts

    322
  • Joined

  • Last visited

Everything posted by CyberShot

  1. nothing happens when I push the button. the password box just sits there like I never pushed the button. What's the best way to send the user to a new page if the button is pushed?
  2. Yea, I got all that, I just posted the essential stuff so that you wouldn't have to look through all of it.
  3. I have a simple form <label for="username" name="username">Username or email</label> <input id="username" name="username" value="" title="username" class="required" tabindex="4" type="text"> </p> <p> <label for="password" name="password">Password</label> <input id="password" name="password" value="" title="password" class="required" tabindex="5" type="password"> </p> <p class="clear"></p> <a href="change_password.php" class="forgot" id="resend_password_link">Forgot your password?</a> <p class="remember"> <input id="submit" value="Sign in" tabindex="6" name="submit" type="submit"> <input id="cancel_submit" value="Cancel" tabindex="7" type="button"> [/code the action is set for includes/handle_form.php and in the handle form, I am just trying to test that I can get the username and password and then echo out the results. Am I doing it wrong? [code] if(isset($_POST['submit'])){ $name = $_POST['username']; $pass = $_POST['password']; echo "$name ."". $pass"; }
  4. I see. Thanks guys. very helpful
  5. well my issue is that I am going through the php documentation and it gives code like this $fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry'); reset($fruit); while (list($key, $val) = each($fruit)) { echo "$key => $val\n"; } and then says that it will output a => apple b => banana c => cranberry but then it doesn't. So I am trying to figure out if most or all or just some of the info on the site is B.S
  6. I was looking at some of the things you could do with php and one of the things I have tried is \n. used this way while(list($key, $val) = each($myArray)){ echo "$key => $val\n"; I expect it to echo the values out on a newline but never does any time I use \n I have tried \r. What am I missing
  7. for some reason it started working on it's own
  8. I have small script to generate a random quote when the page loads. It works. I decided to use javascript to refresh the div the code sits in every 10 seconds so that every quote would display if you were on the page for a while. My problem is that when the page loads, the div the quote sits in is empty and then after the given time, one quote will show up but it does not change. Here is my code <?php class quotes { function quotes() { switch(intval(rand(1,5))) { case 1: $this->quote = "A computer once beat me at chess, but it was no match for me at kick boxing -Emo Philips" ; break; case 2: $this->quote = "It was when I found out I could make mistakes that I knew I was on to something -Ornette Coleman" ; break; case 3: $this->quote = "You can't build a reputation on what you're going to do -Henry Ford"; break; case 4: $this->quote = "People are just as happy as they make up their minds to be -Abraham Linkcoln"; break; case 5: $this->quote = "Good advice is something a man gives when he is too old to set a bad example -Francois de La Rochefoucauld "; break; } } } $quotes = new quotes(); echo $quotes->quote; ?> and the jquery to run it function randomQuote(){ $('#rand').load('includes/quotes.php'); } $(document).ready(function(){ setInterval("randomQuote()", 1000); });
  9. I wasn't asking for you to do my homework for me, but just to explain a few things. I included the zip file so that you could see what the code is doing and offer that explanation, the code is very short. I was finally able to get a hold of the instructor and we just discussed it so I am good now. Thanks for offering your help.
  10. edit. I figure for number 6. all I need to do is add var $pass; I figure that number 7 says to use it in similar ways as used in customer.php. Well that would mean md5. But the password already is md5. So what is this new class property suppose to do?
  11. I don't have any idea. The problem is that I don't know what the end result is suppose to be. we did not write all this code. The instrutor gave it to us then said modify it to work. I could spend a month figuring out how all this works. I don't have that much time. I need to turn it in on friday. is there anything in there that you can explain?
  12. Hey guys. I am a student at a local college taking a class in php right now. I have a project due on friday that I can not figure out. Actually none of the other students in can figure it out either and the instructor seems to be missing right now. Can you take a look at the files and give me a hint. There are only two. there are only three short files. the instructions were as follows 1. Copy the images subfolder from your project_02 folder to your project_03 folder. 2. Copy the default.css file from your project_02/styles folderr to your project_03/styles folder. 3. Copy the rednote_2_objects three php files to your project_03 folder, renaming MusicStore.php to BikeSite.php and MusicStoreTester.php to BikeSiteTester.php. 4. Edit each php file to replace all references (including comments) for the rednote website with appropriate references for the your evolving bluebike website. 5. Edit each php file to replace all references to the music store classes with appropriate references to the your bike site classes. 6. Add a new class property named $pass to the BikeSite class. 7. Modify the BikeSite class methods (as needed) to make use of $pass in ways similar to the uses made of the $pass property by the Customer class. 8.Modify any existing tests or add new tests to BikeSiteTester.php to accomodate the changes to the BikeSite class. I have done everything except 6,7,8. I don't understand how to do those last few instructions. Any help would be greatly appreciated. Keep in mind, I have only been studying php for 3 weeks. [attachment deleted by admin]
  13. I thought about javascript, but thought there might be a way to do it with php. I tried using a loop but when I do that, it doesn't loop the script, it loops through and prints a fiew characters of the quotes.
  14. I see how it works. how do you make it so that it would display a random quote every minute instead of just when the page is refreshed?
  15. Hello. I am learning php and I thought I would try my hand at new classes by putting together a small snippet for random quotes. I can't figure out how to get the code working though. I know how to do it without the class by echoing the $quote. But I want to learn how to do it in the class. This is my first attempt at code like this. Can you please look it over and explain how to get it working? I am calling the script in my main index file with this <?php public class fav_guote() function quotes() { switch(rand(1,6)) { case 1: $quote = "Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming – WOW – What a Ride! /n -Anon" ; break; case 2: $quote = "It was when I found out I could make mistakes that I knew I was on to something. /n -Ornette Coleman" ; break; case 3: $quote = "You can't build a reputation on what you're going to do /n -Henry Ford"; break; case 4: $quote = "People are just as happy as they make up their minds to be /n -Abraham Linkcoln"; break; case 5: $quote = "Good advice is something a man gives when he is too old to set a bad example /n -François de La Rochefoucauld "; break; case 6: $quote = "I wish I owned this site"; break; } } } $quotes = new quotes(); echo $quotes; ?> <?php include('includes/quotes.php'); ?>
  16. I was doing some reading on php functions and I found that to make a string all uppercase you would do strToUpper($str) I also found that php manual says to use mb_strToUpper($str) both work and it doesn't matter if I use uppercase or lowercase in the function, it still works. So my question is, "Why does the function work either way with mb or without mb and what does mb suppose to mean?" and is using uppercase in the function name a user preference or should I use all lowercase? strtoupper versus strToUpper?
  17. Ok, Thanks guys
  18. I like it. But you haven't yet explained what it does. LOL. What does the colon : do all by itself as posted above in the wordpress code? Why is it there all by itself? What purpose does it serve.
  19. I just got the code from wordpress. that is where I have seen it used. I know it's not just for wordrpess. What I am trying to do is understand what it is doing there. What purpose is it serving? what does it mean to be all alone like that?
  20. I get that. But how does the ternary operator operate on it's own as in the wordpress sample code above? It doesn't follow the format of $someVariable = (BooleanCondition) ? 'ValueIfBooleanConditionIsTrue' : 'ValueIfBooleanConditionIsFalse';
  21. I am learning php. I just read about another way to write an if statement $agestr = ($age < 16) ? 'child' : 'adult'; So I understand what is being done here. The thing that threw me before was the : What I am trying to figure out is what the : means by itself. I have seen code in wordpress that says things like this <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> what purpose would the : serve in this situation.
  22. good idea.
  23. I have an html script already made up with a login username and password box. I want to make a database that will store just one user name and one password. The idea is that I can give this info to certain people and they will be able to login to the the site using that info. But I am having trouble creating the table. Not sure it's right for this purpose. Here is what I have CREATE TABLE login( username varchar NOT NULL, password varchar NOT NULL, ); How do I go about asigning the values for username and password in this format? Or should I try that using phpMyAdmin?
  24. Thanks my friend. I did that once, but I think I missed it on another line so it gave me a mysql syntax error, so I thought something was wrong with the semi colon. But I just retried and it works now.
  25. I am trying to create a database using wamp. I used the comand console in the wamp menu to create the database. I have a password on it. So when I open it, it asks for the password, I type it in and then it gives me the mysql> prompt like it's suppose to . So then I type CREATE DATABASE databaseName I am expecting it to return Query OK, 1 row affected (0.05 sec) Instead what I get is just this -> So then the next step is to type USE databasename In which case I would expect it to say Database changed mysql> But all I get is -> Anyone ever seen this and know what the problem is?
×
×
  • 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.