Jump to content


Photo

Trouble in Updating data using drop down


  • Please log in to reply
4 replies to this topic

#1 massive

massive
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 28 February 2006 - 06:12 AM

Hi guyz, i have trouble in updating my data using drop-down menus i don't know whats wrong with it here is a part of my script:

-------script for querying---------

<?  

    if((!isset($_GET['id']) || trim($_GET['id']) == ''))
        {
            die('Missing record ID!');
        }
 
    $connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die('Unable to connect!');
    mysql_select_db(DB_NAME) or die('Unable to select database');
    $id = $_GET['id'];
    $q = "SELECT username, ServiceType FROM subscription WHERE username = '$id'";
    $w = mysql_query($q) or die("Error in query: $q. " . mysql_error());
  
    if(isset($_POST['change'])) 
    {
    
        $query  = "UPDATE subscription SET ServiceType = '" . $_POST['service'] . "' WHERE username = '$id'";
    $result = mysql_query($query) or die("Error in query: $query. " . mysql_error());
  
  }
  if($result)
  {
      header("Location: updatesuccess.php");
  }
?>    


-----html drop down menu declaration----------
<select name="service">
          <option>-----------</option>
          <option value="NR5">NR5</option>
          <option value="NR10">NR10</option>
          <option value="NR15">NR15</option>
          <option value="NR20">NR20</option>
          <option value="NR25">NR25</option>
          <option value="NR30">NR30</option>
          <option value="NR40">NR40</option>
          <option value="NR50">NR50</option>
          <option value="NR60">NR60</option>
          <option value="NR80">NR80</option>
          <option value="NR100">NR100</option>
          <option value="NR120">NR120</option>
          <option value="R10">R10</option>
          <option value="R20">R20</option>
          <option value="R30">R30</option>
          <option value="R40">R40</option>
          <option value="R50">R50</option>
          <option value="R60">R60</option>
          <option value="R80">R80</option>
          <option value="R100">R100</option>
          <option value="R120">R120</option>
        </select>


------here is the submit button declaration--------
<input type="submit" name="change"  value="Upgrade">

hmmm i'm quite puzzled...wondering where did i go wrong pls help...thank you

#2 moberemk

moberemk
  • Members
  • PipPipPip
  • Advanced Member
  • 695 posts

Posted 28 February 2006 - 12:14 PM

You don't need to include the input button. If we can't figure out how you marked up your forms, then we should be called amateurs and thrown to the wolves.
That being said, did you include values and names for the options? I've done stupid stuff like that before.
Disclaimer: No matter how harsh I may be, I'm always IMO only.

#3 massive

massive
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 28 February 2006 - 03:02 PM

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
You don't need to include the input button. If we can't figure out how you marked up your forms, then we should be called amateurs and thrown to the wolves.
That being said, did you include values and names for the options? I've done stupid stuff like that before.
[/quote]

are you referring to the drop-down menu? if thats the one...Yes i did include "value" in the options

<option value="NR5">NR5</option> <- are you referring to this one...? thanks

#4 moberemk

moberemk
  • Members
  • PipPipPip
  • Advanced Member
  • 695 posts

Posted 28 February 2006 - 08:35 PM

Then I have no idea.
Disclaimer: No matter how harsh I may be, I'm always IMO only.

#5 massive

massive
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 01 March 2006 - 03:46 PM

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Then I have no idea.
[/quote]

i see..well thanks for your time ^_^....hmmm i've post my topic also at "PHP HELP" one of the forumers said that i should try changing my method ="POST" into method = "GET"...have'nt tried it yet...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users