Jump to content

ItsWesYo

Members
  • Posts

    110
  • Joined

  • Last visited

    Never

Everything posted by ItsWesYo

  1. All I did was replace the // with my own words. Knowing me, I probably did it wrong >_> <?php function getpage($page) {     switch ($page) {           case "whatever": fdfd           break;           case "whatever2": dfdfdfd           break;     default: //put your default page at the end. There is no need for another break after this     } } getpage($_GET['page']);//you need this to execute your code ?>
  2. everytime i remove "// put your php stuff here" and the other two, it comes up with an error on a break code.
  3. It's okay and thanks for helping, man.
  4. Well, too bad that code doesn't work :P "Parse error: parse error, unexpected T_VARIABLE, expecting T_STRING in /home/evermore/public_html/wes/beta/index.php on line 2"
  5. [b]links.php[/b] (links will be displayed from a mysql database) [code] <?php include ("http://www.evermoreforums.com/wes/header.php"); $page = ((isset($_REQUEST['id']))?($_REQUEST['id']):('')); switch($page) { case "1": { echo ( " testing " ); break; } default: { echo ( " blah, the main page " ); break; } } ?> [/code] [b]db.php[/b] [code] <? mysql_connect("localhost","user","password"); mysql_select_db("my_database"); [/code] [b]The question is:[/b] Would I do this to 'links.php'? [code] <?php include ("http://www.evermoreforums.com/wes/header.php"); $page = ((isset($_REQUEST['id']))?($_REQUEST['id']):('')); switch($page) { case "1": { include ("db.php"); $result = mysql_query("select * from news"); while($r=mysql_fetch_array($result)) {   $title=$r["title"];   $message=$r["message"];   echo "$title <br> $message<br>"; } ?> " ); break; } default: { echo ( " blah, the main page " ); break; } } ?> [/code] Sorry if it seems confusing
  6. Ronald, would you be able to help me with the javascript and such?
  7. I was wondering on how you would make different themes for your site. Example: A person happens to see your site and wants to view it in a different color. Is there a way I can do that using cookies or something?
  8. Well. I'm no PHP expert or anything ... but wouldn't you need to have mysql to keep track of user points?
  9. [b]contact.php[/b] [code] <?php include ("http://www.evermoreforums.com/wes/header.php"); $page = ((isset($_REQUEST['page']))?($_REQUEST['page']):('')); switch($page) { case "sent": { include ("http://www.evermoreforums.com/wes/contact2.php"); break; } default: { include ("http://www.evermoreforums.com/wes/contact1.php"); break; } } ?> [/code] [b]contact1.php (the form)[/b] [code] <center> <table><tr><td> <form method="POST" action="?page=sent"> <b>1. Please select a type:</b><br> <select name="type"> <option value="comment">Comment <option value="error">Error <option value="other">Other <option value="quiz">Quiz <option value="suggest">Suggestion <option value="tutorial">Tutorial </select><br><br> <b>2. Please enter the content:</b><br> <textarea rows="7" cols="25" name="content"></textarea><br><br> <input type="submit" value="Submit" name="submit"> </form> </td></tr></table> </center> [/code] [b]contact2.php (submits the form)[/b] [code] <center> <?php if(isset($_POST['submit'])) { $to = "wes@evermore.com"; $subject = "Contact Form"; $type = $_POST['type']; $content = $_POST['content']; $body = "Type: $type \n\n Content: $content"; echo "Thanks! I'll get back to you soon."; mail($to, $subject, $body); } else { echo "It seems like there was an error with the form."; } ?> </center> [/code] [b]The problem:[/b] Everytime I fill out the form and submit it ... it comes up with the error message.
  10. So, it would look like this, I assume: [code] foreach($data as $name => $num){ $num = number_format($num); $name = ucfirst(strtolower($name)); $html .="{$name}: {$num}         arsort($data); "; [/code]
  11. Ah, thanks once again.
  12. Sorry for bumping this, but I needed a change of plans for something. For ShogunWarrior's code, how would I include a page in the code?
  13. where would i put the 'SORT_NUMERIC' one at?
  14. [code] foreach($data as $name => $num){ $num = number_format($num); $name = ucfirst(strtolower($name)); $html .="{$name}: {$num} "; [/code] Now. That code is for the total amount of pets. It displays each pet name with the total of each. Example: Pet 1 - 5,000 .... Pet 2 - 7,500 How would I order the numbers from GREATEST to LEAST?
  15. I'm making quizzes (not the "What am I?" type .. the "You scored 9/10" kind) ------------ [b]Overall:[/b] Basically, I want a page (like an admin page) where I can access (thru user/pass) and make new quizzes ------------ [b]Quizzes:[/b] - Name the quiz (ex: Test #1) - Desc of quiz (ex: this is a test of the quiz system) - How many questions (ex: choose how many questions you want ... min of 5, max of 10) - Answer format as: radio boxes (up to 4) , dropdowns or small text box - Creates a new page for quiz ... sets as new id ... 1.php , 2.php , 3.php, 4.php, etc etc - Can edit, delete or set active/inactive - Active: people can view the quiz and answer questions ... Inactive: people can not view it - Includes "header.php" in the coding - Show results at end of quiz ---> how many questions right out of total.
  16. If you check my other quiz post, you'll understand this better. Anyway, How would I go about making a small highscore table (top 10)? I don't know if there is a way to make it without using mysql. (I do have mysql, but my quizzes are not in a db or nothing, just a plain file using php) I want to be able to let people enter their name only .. and when they submit it, it shows their name and score. If someone else gets a better score than them, then their name goes down a spot and such.
  17. By now, you're probably thinking that I'm annoying you with these basic questions >_> Anyway, how would I go about making a simple word scramble code?
  18. Thanks again ... Sorry for these questions ... but I have 1 more. I didn't think of the last two when I was posting this ... Would there be a way to tell the person which questions they got right or wrong? Example: Questions they answer: 1) What's my name? 2) What's my age? Aftermath: You got 1 out of 2 questions right. Question 1: RIGHT Question 2: WRONG
  19. Thanks! Also, would there be a way so a message appears if you get 2/10 and such? Like, if you scored 3/10 .. it would say "You need to study more" or something?
  20. I would like to create a basic quiz. Not the "What kind are you" type. The ones like "You scored 6/10" and such. Can anyone show me how to create  a basic one?
  21. How would I display a PHP code on my site?
  22. So can I use php scripts inside in those pages too?
  23. Recently, I asked my friend if he knew a php code where I could add other pages into the page or whatever. He told me to use elseif and such. Well, I want to have a php script inside it, but it comes up with errors. Here is the whole page code. For the example, I'll use my [b]about.php[/b] code. [code] <?php include ("http://www.evermoreforums.com/wes/header.php"); $page = $_REQUEST['page']; if($page == "basics"){ echo ( " blah, content goes here " ); die(); } elseif($page == "likes"){ echo ( " blah, other content goes here " ); die(); } elseif($page == "dislikes"){ echo ( " other content goes here, again " ); die(); } else { echo ( " this is the page that shows up as 'about.php' like, the "main" page "); die(); } ?> [/code]
  24. Thanks guys, it worked!
×
×
  • 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.