[RESOLVED] Updating specific SQL row's column with HTML form - Page 2
Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28

Thread: [RESOLVED] Updating specific SQL row's column with HTML form

  1. #16
    Junior Member primehalo's Avatar
    Join Date
    Jan 2013
    Posts
    4
    Also, where is the $game_id variable set? Do you ever do something like this:
    PHP Code:
    $game_id = isset($_GET['id']) ? (int)$_GET['id'] : 0

  2. #17
    Member
    Join Date
    Dec 2004
    Posts
    38
    Quote Originally Posted by primehalo View Post
    Where is the $rows['notes'] variable coming from? I don't see where it's set. I think you need to do something like:
    PHP Code:
    if ($row mysqli_fetch_array($result)) {
    // You have data

    And note the single equals sign which means it's an assignment, not a comparison.
    Odd I must have accidentally cleared the fetch array I had and not realized, though I was using

    PHP Code:
    while($rows mysqli_fetch_array($resultMYSQLI_BOTH))

    Either one, though, the text area is still empty, and I cannot get the game_id variable I'm trying to use to represent the extension /file.php?game_id=XX

    I must be going about this the wrong way though I'm still trying to get it working

    Here is the update form with the line you supplied me

    PHP Code:
    <?php 
    $link 
    mysqli_connect('mysql.powerhost.com','u195276486_comp','opl123','u195276486_comp'); 
    if (
    mysqli_connect_errno()) { 
        
    printf("Connect failed: %s\n"mysqli_connect_error()); 
        exit(); 

    $tbl_name="opl_comp"// Table name  
    ?> 
        
         
      <?php 
    $sql
    ="SELECT * FROM $tbl_name WHERE id='45'"
    $result=mysqli_query($link,$sql) or die("Error: ".mysqli_error($link)); 
    ?> 

    <?php
    if ($row mysqli_fetch_array($result)) { 
    // You have data 
    }  

    ?>
      <p>edit game record #<?php echo $game_id;?></p> 
    <form id="form1" name="form1" method="post" action="upaction.php"> 
      <textarea name="notes" id="notes" cols="45" rows="5"><?php echo $row['notes']; ?></textarea> 
      <input type="submit" name="Submit" id="Submit" value="Submit" /> 
    </form> 
       
    <?php 
    // close MySQL connection  
    mysqli_close($link); 
    ?>
    Last edited by bemore; 01-24-2013 at 03:50 AM.

  3. #18
    Junior Member primehalo's Avatar
    Join Date
    Jan 2013
    Posts
    4
    You don't really need to use a while loop if you're just grabbing one row, that's why I used the if statement. After the $row variable is set, you should print it out to the screen just to see what data it has inside. Like var_dump($row);

    I never see you assigning anything to the $game_id variable. You have to get the query variable from the url and assign it to the $game_id variable:
    PHP Code:
    $game_id = isset($_GET['id']) ? (int)$_GET['id'] : 0

  4. #19
    Member
    Join Date
    Dec 2004
    Posts
    38
    Quote Originally Posted by primehalo View Post
    You don't really need to use a while loop if you're just grabbing one row, that's why I used the if statement. After the $row variable is set, you should print it out to the screen just to see what data it has inside. Like var_dump($row);

    I never see you assigning anything to the $game_id variable. You have to get the query variable from the url and assign it to the $game_id variable:
    PHP Code:
    $game_id = isset($_GET['id']) ? (int)$_GET['id'] : 0
    Thanks, Prime! Huge help. Taking me forever to figure how to get that working.

    It seems my update action has broken somehow with all the code I've been messing with, I cannot seem to find what I messed up here, as it refuses to update the database on submit now.

    PHP Code:
    <?php 
    //Connect
    $link mysqli_connect('mysql.powrhost.com','u195276486_comp','opl123','u195276486_comp');
    if (
    mysqli_connect_errno()) {
        
    printf("Connect failed: %s\n"mysqli_connect_error());
        exit();
    }
    $tbl_name="opl_comp";
    $notes=$_POST['notes'];
    //update notes column under specified primary key id
    if(isset($_POST['submit'])) {
    $sql="UPDATE $tbl_name SET notes=".addslashes($notes=$_POST['notes'])." WHERE id='".$game_id."'";
    $result=mysqli_query($link,$sql) or die("Error: ".mysqli_error($link));
    }
    //Thanks
    if($result){
    echo 
    "Thanks. You can view the compatibility list <a href='complist.php'>here</a>.";
    echo 
    "<BR>";
    echo 
    "<a href='insert.php'><-- Back to submission form</a>";
    }

    else {
    echo 
    "There was a problem. Please try again later.";
    }
    ?> 
    <?php 
    // close connection 
    mysqli_close($link);
    ?>
    Is there an obvious issue here I am not seeing? This is the same code I was using earlier when I had originally gotten it to edit specific columns using primary key values without using the variable.

  5. #20
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,766
    You've lost some apostrophes along the way (the error message you're getting will say something about a syntax error just after notes=).
    Incidentally, the $notes= bit there is redundant - you're already doing that two lines earlier (even before you've checked to see if anything was submitted, in fact).
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

  6. #21
    Junior Member primehalo's Avatar
    Join Date
    Jan 2013
    Posts
    4
    Exactly what I was going to say. When an SQL statement isn't doing what you expect, print out your $sql variable so you can see the full SQL statement it's trying to execute. That usually gives you clues as to what's wrong.

  7. #22
    Member
    Join Date
    Dec 2004
    Posts
    38
    PHP Code:
    //table
    $tbl_name="opl_comp";

    //grab text from the form
    $notes=$_POST['notes'];

    //update notes column under specified primary key id
    if(isset($_POST['submit'])) {
    $sql="UPDATE $tbl_name SET notes='".addslashes($_POST['notes'])."' WHERE id='52'";
    $result=mysqli_query($link,$sql) or die("Error: ".mysqli_error($link));

    Haha I did, hmm.. funny. Stoner move, I guess. Okay, so I just copied the same code I posted on the previous page (when it was working) and still it wont update the column

    Perhaps the problem is in the other page?

    edit: I posted before refreshing the page xD How can I go about running a $sql statement to check the errors on the page? I tried

    PHP Code:
    $result=mysqli_query($link,$sql) or die("Error: ".mysqli_error($sql)); 
    but it gives me a blank page.
    Last edited by bemore; 01-24-2013 at 06:39 AM.

  8. #23
    Member
    Join Date
    Dec 2004
    Posts
    38
    Solved everything. I was able to create a page that will call all the information from the columns to be edited with the game_id variable. At first, I only wanted to have the one column open to edit.. but after accomplishing this, I decided to go for more. Thank you all for the help and not spood feeding me that which I was seeking.

    Here is the code for future reference by searches.

    PHP Code:
    <?php
    //CONNECT TO THE MYSQL DATABASE
    $link mysqli_connect('server','username','password','database');
    if (
    mysqli_connect_errno()) {
        
    printf("Connect failed: %s\n"mysqli_connect_error());
        exit();
    }

    //CREATE THE VARIABLES TO IDENTIFY THE DIFFERENT FORM INPUTS
    $tbl_name="opl_comp";

    //VARIABLE TO ASSIGN PRIMARY KEY VALUE SO THE FORM KNOWS WHICH ROW IS BEING EDITED
    $game_id = isset($_GET['game_id']) ? (int)$_GET['game_id'] : 0

    //IMPLODE THE CHECKBOX SELECTIONS EG 1, 2, 3
    if(isset($_POST['mode'])) {
    $mode implode(","$_POST['mode']);   
    } else {
    $mode "None";
    }

    $region=$_POST['region'];
    $vmc=$_POST['vmc'];
    $smb=$_POST['smb'];
    $hdd=$_POST['hdd'];
    $usb=$_POST['usb'];
    $notes=$_POST['notes'];
    $comp=$_POST['comp'];
    $oplver=$_POST['oplver'];
    $gamename=$_POST['gamename'];
    ?>

    <?php
    //ON SUBMIT, UPDATE THE MYSQL DATABASE WITH THE NEW DATA INSIDE THE FORM
    if(isset($_POST['submit'])) {
    $update="UPDATE $tbl_name SET notes='".addslashes($_POST['notes'])."', gamename='$gamename', region='$region', mode='$mode', smb='$smb', hdd='$hdd', usb='$usb', comp='$comp', vmc='$vmc', oplver='$oplver' WHERE id='".$game_id."'";
    $result=mysqli_query($link,$update) or die("Error: ".mysqli_error($update));
    }  
    ?>

    <?php
    //SELECT ALL FROM TABLE WHERE THE ID COLUMN IS THE PRIMARY KEY VALUE
    $sql "SELECT * FROM $tbl_name WHERE id = '".$game_id."'";

    //SUBMIT QUERY TO DATABASE AND CAPTURE RESULTS FOR THE FORM INPUTS
    $result $link->query($sql) or die(mysqli_error($sql));
    $query=getenv(QUERY_STRING);
    parse_str($query);
    ?>



    <?php
    //LOOP RETREIEVED DATA TO BE DISPLAYED INSIDE OF THE FORM
        
    while ($row $result->fetch_assoc()) {
            
    ?>
            <h2>Update Entry #<?php echo $game_id;?><BR />
      PLEASE BE CONSIDERATE WHEN EDITING AN ENTRY</h2>
    <table width="565" border="0" bgcolor="#006699">
      <form action="" method="post" name="form1" id="form1" onsubmit="return formCheck(this);">
      <tr>
        <td width="171" bgcolor="#003333"><strong>&nbsp;&nbsp;Game Name</strong></td>
        <td width="384" bgcolor="#003333">&nbsp;&nbsp;<input name="gamename" type="text" id="gamename" value="<?php echo $row['gamename']; ?>" size="45" /></td>
      </tr>
      <tr>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;Region / OPL Ver</strong></td>
        <td bgcolor="#003333">&nbsp;&nbsp;<select name="region" id="region">
          <option selected="selected" value="NTSC-U">NTSC-U</option>
          <option value="NTSC-J">NTSC-J</option>
          <option value="PAL">PAL</option>
          <option value="OTHER">OTHER</option>
        </select>&nbsp;&nbsp;&nbsp;&nbsp;<select name="oplver" id="oplver">
          <option value="0.6">OPL 0.6</option>
          <option value="0.6">OPL 0.7</option>
          <option value="0.8">OPL 0.8</option>
          <option selected="selected" value="0.9">OPL 0.9</option>
        </select></td>
      </tr>
      <tr>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;Result</strong></td>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;Compatible</strong>
                <input name="comp" type="radio" id="comp" value="http://www.oplinfo.x11s.org/files/comp.gif"/>
                <strong>Incompatible</strong><label for="comp">  
      <input type="radio" name="comp" id="comp" value="http://www.oplinfo.x11s.org/files/incomp.gif" />
      <strong>Issues</strong>
                <input type="radio" name="comp" id="comp" value="http://www.oplinfo.x11s.org/files/issues.gif" />
                </label></td>
      </tr>
      <tr>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;VMC Support</strong></td>
        <td bgcolor="#003333">&nbsp;&nbsp;Yay
                  <input type="radio" name="vmc" id="vmc" value="VMC"/>
                  Nay 
                <input type="radio" name="vmc" id="vmc" value="MC"/>&nbsp;</td>
      </tr>
      <tr>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;Load Methods</strong></td>
        <td bgcolor="#003333">&nbsp;&nbsp;SMB
                  <input type="checkbox" name="smb" id="smb" value="SMB"/>
                   USB
                   <input type="checkbox" name="usb" id="usb" value="USB"/>
                   HDD
                   <input type="checkbox" name="hdd" id="hdd" value="HDD"/>
          </td>
      </tr>
      <tr>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;Modes</strong></td>
        <td bgcolor="#003333">&nbsp;&nbsp;1
                <input type="checkbox" name="mode[]" id="mode" value="1" />
     2
     <input type="checkbox" name="mode[]" id="mode" value="2" />
     3
     <input type="checkbox" name="mode[]" id="mode" value="3" />
     4
     <input type="checkbox" name="mode[]" id="mode" value="4" /> 5
    <input type="checkbox" name="mode[]" id="mode" value="5" />
     6
     <input type="checkbox" name="mode[]" id="mode" value="6" />
     7
    <input type="checkbox" name="mode[]" id="mode" value="7" />
     8
     <input type="checkbox" name="mode[]" id="mode" value="8" /></td>
      </tr>
      <tr>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;Notes</strong></td>
        <td bgcolor="#003333">&nbsp;&nbsp;<textarea name="notes" id="notes" cols="38" rows="2"><?php echo $row['notes']; ?></textarea></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="28" bgcolor="#003333">&nbsp;<input type="submit" name="submit" value="Update" id="submit" /></td>
        <td bgcolor="#003333"><strong>&nbsp;*refrain from clicking submit more then once*</strong></td>
      </tr></form>
    </table>
    <p><A href='complist.php'><strong>VIEW GAME COMPATABILITY DATABASE</strong></A><br />
    </p>
    </center>

    <?php
    //END THE LOOP OF INFORMATION TO THE FORM
    }
    ?>

    <?php
    //ESCAPE
    $gamename mysqli_real_escape_string($link$_POST['gamename']);
    $region mysqli_real_escape_string($link$_POST['region']);
    $notes mysqli_real_escape_string($link$_POST['notes']);
    $oplver mysqli_real_escape_string($link$_POST['oplver']);
    $usb mysqli_real_escape_string($link$_POST['usb']);
    $smb mysqli_real_escape_string($link$_POST['smb']);
    $hdd mysqli_real_escape_string($link$_POST['hdd']);
    $comp mysqli_real_escape_string($link$_POST['comp']);

    ?>

    <?php 
    //CLOSE THE CONNECTION TO THE DATABASE
    mysqli_close($link);
    ?>

  9. #24
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,348
    Since you seem to want your code to be referenced in the future, or even if you plan on actually using the above code verbatim on a live website, you might want to take note of the several issues it has:

    1. Outputting SQL error messages/info to the user is both dangerous and unhelpful. It's dangerous in that you're needlessly exposing the inner-workings of your database to the end user (who might be attempting to maliciously attack your DB in the first place and would be delighted to learn such details), and it's unhelpful in that it doesn't tell you what the problem is (after all, you are the one who's in a position to fix the errors in the first place).

      Consider handling the errors gracefully and logging all of the relevant details instead.
    2. Code like this:
      PHP Code:
      $region=$_POST['region'];
      $vmc=$_POST['vmc'];
      $smb=$_POST['smb'];
      $hdd=$_POST['hdd'];
      $usb=$_POST['usb'];
      $notes=$_POST['notes'];
      $comp=$_POST['comp'];
      $oplver=$_POST['oplver'];
      $gamename=$_POST['gamename']; 
      blindly assumes that all of those POST'ed elements exist. You should always verify external data exists before you attempt to use it.
    3. This SQL query:
      PHP Code:
      $update="UPDATE $tbl_name SET notes='".addslashes($_POST['notes'])."', gamename='$gamename', region='$region', mode='$mode', smb='$smb', hdd='$hdd', usb='$usb', comp='$comp', vmc='$vmc', oplver='$oplver' WHERE id='".$game_id."'"
      uses unsanitized user-supplied data. You should never do this, else your code will be vulnerable to SQL injection attacks and/or just plain SQL errors.
    4. Speaking of the above query, addslashes() should never be used to prepare data for use in a SQL query. (At least, certainly not to a MySQL DBMS, since there are better suited functions for the job.)
    5. PHP Code:
      $query=getenv(QUERY_STRING);
      parse_str($query); 
      What is the purpose of these lines? Not only do you not define a constant named QUERY_STRING (meaning an error message is going to be generated), but both of those lines seem rather pointless - why not just use the $_GET array?

      What's worse, you're basically mimicking the dreaded register_globals behavior. If you're not aware why this behavior is one of the ugly mistakes of PHP's history, start here: security.globals.
    6. Your HTML is littered with groups of elements that share the same "id" attribute value. This is not only meaningless but violates the W3C standard. You might want to make sure you're producing valid HTML if you actually expect various browsers to interpret it and behave correctly/reliably.

      Of course, that's not even getting into the 1990s style <table>-is-awesome-for-design-layout! debacle.
    7. This code:
      PHP Code:
      //ESCAPE
      $gamename mysqli_real_escape_string($link$_POST['gamename']);
      $region mysqli_real_escape_string($link$_POST['region']);
      $notes mysqli_real_escape_string($link$_POST['notes']);
      $oplver mysqli_real_escape_string($link$_POST['oplver']);
      $usb mysqli_real_escape_string($link$_POST['usb']);
      $smb mysqli_real_escape_string($link$_POST['smb']);
      $hdd mysqli_real_escape_string($link$_POST['hdd']);
      $comp mysqli_real_escape_string($link$_POST['comp']); 
      is pointless since you never use any of those variables after those lines... not to mention the fact that you've already let the user inject whatever malicious SQL code (s)he desired several statements before these.

  10. #25
    Member
    Join Date
    Dec 2004
    Posts
    38
    Thank you for the informative post. I was hoping that someone might come along and do just that. I have only been coding PHP for 2 days, so I know just by comparing to other code I have seen that mine is in no way legitimate for wide live use. Your language is a tad overly critical, but your post is definitely appreciated.

    I wrote this to submit compatibility information between PS2 games and PS2 homebrew. I highly doubt that any of the issues with the code will effect it's health or purpose in any way. It is working 100% correctly, and I have tested it a lot. As far as displaying properly.... It's all of 1 form, a couple input fields and some checkboxes so I don't think it really matters

    blindly assumes that all of those POST'ed elements exist.
    All of those fields are required before a submission is made to the database, so.. I'm not sure if what you're saying on this matter still stands?

    uses unsanitized user-supplied data. You should never do this, else your code will be vulnerable to SQL injection attacks and/or just plain SQL errors.
    Perhaps some constructive elaboration on your expertise is in need here...

    Speaking of the above query, addslashes() should never be used to prepare data for use in a SQL query. (At least, certainly not to a MySQL DBMS, since there are better suited functions for the job.)
    What functions are better suited for the job, and how would they be applied? Also, why "never"?

    is pointless since you never use any of those variables after those lines.
    So, you should use the escape immediately after using the variable? I was not aware that the location of the escapes matter, since nothing is submitted until you click submit.. In this case, would the escapes be used properly if they are placed after the UPDATE?
    Last edited by bemore; 01-24-2013 at 04:05 PM.

  11. #26
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,766
    Quote Originally Posted by bemore
    All of those fields are required before a submission is made to the database, so.. I'm not sure if what you're saying on this matter still stands?
    They may be required, but you never check that they've been provided (you can't trust the browser to do it).

    Perhaps some constructive elaboration on your expertise is in need here...
    http://www.php.net/manual/en/securit...-injection.php

    What functions are better suited for the job, and how would they be applied?
    See posts #10 and #11 in this thread.

    So, you should use the escape immediately after using the variable?
    No, before you use the variable so that you used the escaped value - doing it after is, as bradgrafelman says, pointless (and, as he points out, you never used the escaped values).
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

  12. #27
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,348
    Quote Originally Posted by bemore View Post
    Also, why "never"?
    Because addslashes() doesn't do the same thing as mysqli_real_escape_string(), for example. I guess I say "never" because it's similar to saying you should "never" use a brand new smartphone to sink a nail into a 2x4 when you've got a hammer at your disposal as well. It's not to say that you can't get the job done most of the time... just that it doesn't make sense to not use the better-suited tool instead.

    Quote Originally Posted by bemore View Post
    So, you should use the escape immediately after using the variable? I was not aware that the location of the escapes matter
    Well the "location" certainly matters as far as order of operations goes. What's the point of making data safe for use inside a SQL query if you've already used the data in a SQL query? If you were shoveling manure all day for a living, would you come home and wash ("sanitize") your hands immediately after you had prepared and ate dinner?

  13. #28
    Member
    Join Date
    Dec 2004
    Posts
    38
    you should "never" use a brand new smartphone to sink a nail into a 2x4
    Hahaha, this had me laughing.

    What's the point of making data safe for use inside a SQL query if you've already used the data in a SQL query?
    After it was mentioned, no it doesn't make sense to use it after a query. Very silly to not assume this right away when learning PHP, but hey I know now and that is all I care about.

    Here is the corrected code

    PHP Code:
    <?php
    //CONNECT TO THE MYSQL DATABASE
    $link mysqli_connect('host','user','pass','database');
    if (
    mysqli_connect_errno()) {
        
    printf("Connect failed: %s\n"mysqli_connect_error());
        exit();
    }

    //CREATE THE VARIABLES TO IDENTIFY THE DIFFERENT FORM INPUTS
    $tbl_name="opl_comp";

    //VARIABLE TO ASSIGN PRIMARY KEY VALUE SO THE FORM KNOWS WHICH ROW IS BEING EDITED
    $game_id = isset($_GET['game_id']) ? (int)$_GET['game_id'] : 0

    //IMPLODE THE CHECKBOX SELECTIONS EG 1, 2, 3
    if(isset($_POST['mode'])) {
    $mode implode(","$_POST['mode']);   
    } else {
    $mode "None";
    }

    //VARIABLES TO ASSIGN THE FORM'S INPUT FIELD VALUES TO WHICH COLUMN THE DATA WILL BE INSERTED INTO
    $region=$_POST['region'];
    $vmc=$_POST['vmc'];
    $smb=$_POST['smb'];
    $hdd=$_POST['hdd'];
    $usb=$_POST['usb'];
    $notes=$_POST['notes'];
    $comp=$_POST['comp'];
    $oplver=$_POST['oplver'];
    $gamename=$_POST['gamename'];
    ?>

    <?php
    //ESCAPE THE VARIABLE INPUTS
    $gamename mysqli_real_escape_string($link$_POST['gamename']);
    $region mysqli_real_escape_string($link$_POST['region']);
    $notes mysqli_real_escape_string($link$_POST['notes']);
    $oplver mysqli_real_escape_string($link$_POST['oplver']);
    $usb mysqli_real_escape_string($link$_POST['usb']);
    $smb mysqli_real_escape_string($link$_POST['smb']);
    $hdd mysqli_real_escape_string($link$_POST['hdd']);
    $comp mysqli_real_escape_string($link$_POST['comp']);


    //ON SUBMIT, UPDATE THE SQL DATABASE TABLE WITH THE NEW DATA INSIDE THE FORM INPUT FIELDS
    if(isset($_POST['submit'])) {
    $update="UPDATE $tbl_name SET notes='$notes', gamename='$gamename', region='$region', mode='$mode', smb='$smb', hdd='$hdd', usb='$usb', comp='$comp', vmc='$vmc', oplver='$oplver' WHERE id='".$game_id."'";
    $result=mysqli_query($link,$update) or die("Error: ".mysqli_error($update));
    }  
    ?>

    <?php
    //SELECT ALL FROM SQL DATABASE TABLE WHERE THE id COLUMN IS THE PRIMARY KEY VALUE
    $sql "SELECT * FROM $tbl_name WHERE id = '".$game_id."'";

    //SUBMIT QUERY TO DATABASE
    $result $link->query($sql) or die(mysqli_error($sql));
    ?>

    <?php
    //LOOP RETREIEVED DATA TO BE DISPLAYED INSIDE OF THE FORM
        
    while ($row $result->fetch_assoc()) {
            
    ?>
            <h2>Update Entry #<?php echo $game_id;?><BR />
      PLEASE BE CONSIDERATE WHEN EDITING AN ENTRY</h2>
    <table width="565" border="0" bgcolor="#006699">
      <form action="" method="post" name="form1" id="form1" onsubmit="return formCheck(this);">
      <tr>
        <td width="171" bgcolor="#003333"><strong>&nbsp;&nbsp;Game Name</strong></td>
        <td width="384" bgcolor="#003333">&nbsp;&nbsp;<input name="gamename" type="text" id="gamename" value="<?php echo $row['gamename']; ?>" size="45" /></td>
      </tr>
      <tr>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;Region / OPL Ver</strong></td>
        <td bgcolor="#003333">&nbsp;&nbsp;<select name="region" id="region">
          <option selected="selected" value="http://www.oplinfo.x11s.org/files/images/U.png">NTSC-U</option>
          <option value="http://www.oplinfo.x11s.org/files/images/J.png">NTSC-J</option>
          <option value="http://www.oplinfo.x11s.org/files/images/E.png">PAL</option>
          <option value="http://www.oplinfo.x11s.org/files/images/O.png">OTHER</option>
        </select>&nbsp;&nbsp;&nbsp;&nbsp;<select name="oplver" id="oplver">
          <option value="0.6">OPL 0.6</option>
          <option value="0.6">OPL 0.7</option>
          <option value="0.8">OPL 0.8</option>
          <option selected="selected" value="0.9">OPL 0.9</option>
        </select></td>
      </tr>
      <tr>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;Result</strong></td>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;Compatible</strong>
                <input name="comp" type="radio" id="comp" value="http://www.oplinfo.x11s.org/files/images/comp.gif"/>
                <strong>Incompatible</strong><label for="comp">  
      <input type="radio" name="comp" id="incomp" value="http://www.oplinfo.x11s.org/files/images/incomp.gif" />
      <strong>Issues</strong>
                <input type="radio" name="comp" id="issues" value="http://www.oplinfo.x11s.org/files/images/issues.gif" />
                </label></td>
      </tr>
      <tr>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;VMC Support</strong></td>
        <td bgcolor="#003333">&nbsp;&nbsp;Yay
                  <input type="radio" name="vmc" id="vmc" value="VMC"/>
                  Nay 
                <input type="radio" name="vmc" id="mc" value="MC"/>&nbsp;</td>
      </tr>
      <tr>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;Load Methods</strong></td>
        <td bgcolor="#003333">&nbsp;&nbsp;SMB
                  <input type="checkbox" name="smb" id="smb" value="SMB"/>
                   USB
                   <input type="checkbox" name="usb" id="usb" value="USB"/>
                   HDD
                   <input type="checkbox" name="hdd" id="hdd" value="HDD"/>
          </td>
      </tr>
      <tr>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;Modes</strong></td>
        <td bgcolor="#003333">&nbsp;&nbsp;1
                <input type="checkbox" name="mode[]" id="mode1" value="1" />
     2
     <input type="checkbox" name="mode[]" id="mode2" value="2" />
     3
     <input type="checkbox" name="mode[]" id="mode3" value="3" />
     4
     <input type="checkbox" name="mode[]" id="mode4" value="4" /> 5
    <input type="checkbox" name="mode[]" id="mode5" value="5" />
     6
     <input type="checkbox" name="mode[]" id="mode6" value="6" />
     7
    <input type="checkbox" name="mode[]" id="mode7" value="7" />
     8
     <input type="checkbox" name="mode[]" id="mode8" value="8" /></td>
      </tr>
      <tr>
        <td bgcolor="#003333"><strong>&nbsp;&nbsp;Notes</strong></td>
        <td bgcolor="#003333">&nbsp;&nbsp;<textarea name="notes" id="notes" cols="38" rows="2"><?php echo $row['notes']; ?></textarea></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="28" bgcolor="#003333">&nbsp;<input type="submit" name="submit" value="Update" id="submit" /></td>
        <td bgcolor="#003333"><strong>&nbsp;*refrain from clicking submit more then once*</strong></td>
      </tr></form>
    </table>
    <p><A href='index.php'><strong>VIEW GAME COMPATABILITY DATABASE</strong></A><br />
    </p>
    </center>

    <?php
    //END THE LOOP OF DATA TO THE FORM
    }
    ?>

    <?php 
    //CLOSE THE CONNECTION TO THE DATABASE
    mysqli_close($link);
    ?>
    Last edited by bemore; 01-26-2013 at 01:24 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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