Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 10 of 10

Thread: PHP Script

  1. #1
    Join Date
    Sep 2008
    Posts
    718
    Tokens
    0

    Default PHP Script

    I'm working on my first PHP script. It's a panel for my rare values. I'm only trying to get the forum to work atm, then I am going to integrate it into the values. Remember this is my first, and it's probably 100% wrong, so don't yell at me (dentafrice -cough-) lol jk

    Here it is:

    rare_edit.html
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
     <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
     <title>HabbDance Rare Value Database</title>
    </head>
    <body>
     <h2>Rare Value Editor v1</h2>
     <form action="rare_edit.php" method="post">
      <fieldset><br />
       <p>
        <label>Which rare would you like to edit today?</label>
        <select name="rare">
         <option value = "Typewriter">
          Typewriter
         </option>
         <option value = "Throne">
          Throne 
         </option>
         <option value = "HC_Sofa">
          HC Sofa
         </option>
        </select><br />
        What is this rare worth? <input type="text" name="value" /><br />
        <label>What is the status of this rare?</label>
        <select name="status">
         <option value = "Increasing">
          Increasing
         </option>
         <option value = "Stable">
          Stable 
         </option>
         <option value = "Decreasing">
          Decreasing
         </option>
        </select>
       </p>
         <button type = "submit">
          Change
         </button>
      </feildset>
     </form>
    </body>
    </html>
    rare_edit.php
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
     <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
     <style type="text/css">
      <!--
         body {
          font-family: Verdana;
          font-size: 12px;
      -->
     </style>
     <title>HabbDance Rare Value Database</title>
    </head>
    <body>
     <h2>Rare Value Editor v1</h2>
     <? php
      //gather the variables
      $rare = $_REQUEST["rare"];
      $value = $_REQUEST["value"];
      $status = $_REQUEST["status"];
     
       print "You have succesfully update $rare to $value, $status."
     ?>
    </body>
    </html>
    I keep getting this when I submit the forum:
    Parse error: syntax error, unexpected T_VARIABLE in /homepages/34/d237406810/htdocs/wsb4850525601/beta/db/rare_edit.php on line 19

    So help please :] Thanks!
    +.net - omg it's coming o_o

  2. #2
    Join Date
    Dec 2007
    Posts
    132
    Tokens
    0

    Default

    first it's <?php and nt <? php

    2nd $rare = $_REQUEST['rare']; and not ""

    It think lol,
    waz ;]
    Last edited by wazup999; 10-11-2008 at 12:20 AM.


  3. #3
    Join Date
    Sep 2008
    Posts
    718
    Tokens
    0

    Default

    Thanks so much Worked great! +rep

    &***** at your sig
    +.net - omg it's coming o_o

  4. #4

    Default

    Default
    first it's <?php and nt <? php

    2nd $rare = $_REQUEST['rare']; and not ""

    It think lol,
    waz ;]
    No you can use both " and ' in $_REQUEST also for HabbDance I would reconsider using $_REQUEST as not only someone could easily submit the form via a $_GET request but it could also cause conflicts if you have a $_COOKIE or $_GET or $_POST that are the same key unless request order is specified. So avoid the hassle and use $_POST. Also Wazup is right, since <? signifies a short-tag opening, it sees it as <? followed by php which isn't in context of opening.

  5. #5
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Iszak View Post
    No you can use both " and ' in $_REQUEST also for HabbDance I would reconsider using $_REQUEST as not only someone could easily submit the form via a $_GET request but it could also cause conflicts if you have a $_COOKIE or $_GET or $_POST that are the same key unless request order is specified. So avoid the hassle and use $_POST. Also Wazup is right, since <? signifies a short-tag opening, it sees it as <? followed by php which isn't in context of opening.
    I'm sure a total PHP beginner could easily understand that. :rolleyes:

    @OP: There isn't anything wrong with using $_REQUEST, but it can pose a security problem in some situations.
    How could this hapen to meeeeeeeeeeeeeee?lol.

  6. #6
    Join Date
    Sep 2008
    Posts
    718
    Tokens
    0

    Default

    Quote Originally Posted by Iszak View Post
    No you can use both " and ' in $_REQUEST also for HabbDance I would reconsider using $_REQUEST as not only someone could easily submit the form via a $_GET request but it could also cause conflicts if you have a $_COOKIE or $_GET or $_POST that are the same key unless request order is specified. So avoid the hassle and use $_POST. Also Wazup is right, since <? signifies a short-tag opening, it sees it as <? followed by php which isn't in context of opening.
    thanks, I'll use $_POST from now on.

    Quote Originally Posted by Hypertext View Post
    I'm sure a total PHP beginner could easily understand that. :rolleyes:

    @OP: There isn't anything wrong with using $_REQUEST, but it can pose a security problem in some situations.
    Your right, didn't understand a word, but I consider Iszak a genius and take his advice

    And I've run into another problem :S
    The way I planned my database will only work for 1 value :p
    How can I change it so that it will work for several?
    Last edited by HabbDance; 10-11-2008 at 12:46 AM.
    +.net - omg it's coming o_o

  7. #7
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by HabbDance View Post
    thanks, I'll use $_POST from now on.
    And I've run into another problem :S
    The way I planned my database will only work for 1 value :p
    How can I change it so that it will work for several?
    Have a table like:

    ID rareName rareValue
    1 Throne 28hc
    2 HC 1hc/70rd
    How could this hapen to meeeeeeeeeeeeeee?lol.

  8. #8
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Hypertext View Post
    Have a table like:

    ID rareName rareValue
    1 Throne 28hc
    2 HC 1hc/70rd
    I thought your were site coder??

    @ontopic, Why are you doing php when you can't do html?

  9. #9
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    the submit button should be
    <input type="submit" value="Submit" />
    Lets set the stage on fire, and hollywood will be jealous.

  10. #10
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Jackboy View Post
    I thought your were site coder??

    @ontopic, Why are you doing php when you can't do html?
    I resigned, I'm way too busy.
    How could this hapen to meeeeeeeeeeeeeee?lol.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •