Why does my php code to edit my mySQL table show as blank page? -


i have edit button @ end of table of mysql records displays in webpage.

when click edit button, however, edit.php generates blank page.

i can't figure out why:

<?php // contact database $connect = mysql_connect("localhost", "xxx", "xxx") or die ("error , check server connection."); mysql_select_db("xxx"); ?>  <?php $posted_id = $_post['id']; ?>  <!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/html; charset=utf-8" /> <title>untitled document</title> </head>  <body>  <div class="form">             <?php   $result = mysql_query("select * ff_projections id = '$posted_id'") or die ("error in query"); if ($row = mysql_fetch_array($result)) {  echo "<form method='post' action='update.php'>"; echo "<label for='player'>player name:</label> <input type='text' name='player' value='" . $row['player'] . "' />"; echo "<label for='pass_yds'>pass yds:</label> <input class='short' type='text' name='pass_yds' value='" . $row['pass_yds'] . "' />"; echo "<label for='pass_tds'>pass tds:</label> <input class='short' type='text' name='pass_tds' value='" . $row['pass_tds'] . "' />"; echo "<label for='int_thrown'>int thrown:</label> <input class='short' type='text' name='int_thrown' value='" . $row['int_thrown'] . "' />"; echo "<label for='rush_yds'>rush yds:</label> <input class='short' type='text' name='rush_yds' value='" . $row['rush_yds'] . "' />"; echo "<label for='rush_tds'>rush tds:</label> <input class='short' type='text' name='rush_tds' value='" . $row['rush_tds'] . "' />"; echo "<input type='submit' name='submit' value='update player' />"; echo "<input type='hidden' name='id' value='" . $row['id'] . "' />"; echo "</form>"; } ?> </div>   </body> </html> 

i have id hidden field because don't want visible or editable.

here page uses edit.php:

<?php // contact database $connect = mysql_connect("localhost", "xxx", "xxx") or die ("error , check server connection."); mysql_select_db("xxx"); ?>  <!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/html; charset=utf-8" /> <title>kick ass fantasy football projections</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript">  $(document).ready(function() {      $(".tab_content").hide();     $(".tab_content:first").show();       $("ul.tabs li").click(function() {         $("ul.tabs li").removeclass("active");         $(this).addclass("active");         $(".tab_content").hide();         var activetab = $(this).attr("rel");          $("#"+activetab).fadein();      }); });  </script> </head>  <body>  <div> <form method="link" action="index.php" style="margin:10px 0px"> <input type="submit" value="add more players" style="padding:6px"> </form>  </div>  <ul class="tabs">      <li class="active" rel="tab1"> qb</li>     <li rel="tab2"> rb</li>     <li rel="tab3"> wr</li>     <li rel="tab4"> te</li>     <li rel="tab5"> k</li>     <li rel="tab6"> def / st</li> </ul>  <div class="tab_container">     <div id="tab1" class="tab_content">      <table cellspacing="0" cellpadding="5" border="1" width="560">     <tr style="text-align:center">     <td style="text-align:left ; width:175px">player name</td>     <td>team</td>     <td>pass yds</td>     <td>pass tds</td>     <td>int thrown</td>     <td>rush yds</td>     <td>rush tds</td>     <td>tfp</td>     <td>edit player</td>     </tr>     <?php     $result = mysql_query("select player, team, pass_yds, pass_tds, int_thrown, rush_yds, rush_tds, total_fantasy_pts, id ff_projections position = 'qb' order pass_yds desc;");      while($row = mysql_fetch_array($result))     {     echo "<tr style=\"text-align:center\"><td style=\"text-align:left\">{$row['player']}</td>";     echo "<td>{$row['team']}</td>";     echo "<td>{$row['pass_yds']}</td>";     echo "<td>{$row['pass_tds']}</td>";     echo "<td>{$row['int_thrown']}</td>";     echo "<td>{$row['rush_yds']}</td>";     echo "<td>{$row['rush_tds']}</td>";     echo "<td>{$row['total_fantasy_pts']}</td>";     echo "<td>{$row['id']}</td>";     echo "<td><form action=\"edit.php\" method=\"post\"><input type=\"submit\" name=\"submit\" value=\"edit\"></form></td></tr>";     }     ?>     </table>      </div> </div>      <div class="tab_container">     <div id="tab2" class="tab_content">      <table cellspacing="0" cellpadding="5" border="1" width="560">     <tr style="text-align:center">     <td style="width:175px ; text-align:left">player name</td>     <td>team</td>     <td>rush yds</td>     <td>rush tds</td>     <td>rec yds</td>     <td>rec tds</td>     <td>rec</td>     <td>fumbles</td>     <td>tfp</td>     </tr>     <?php     $result = mysql_query("select player, team, rush_yds, rush_tds, rec_yds, rec_tds, receptions, fumbles, total_fantasy_pts ff_projections position = 'rb' order rush_yds desc;");      while($row = mysql_fetch_array($result))     {     echo "<tr style=\"text-align:center\"><td style=\"text-align:left\">{$row['player']}</td>";     echo "<td>{$row['team']}</td>";     echo "<td>{$row['rush_yds']}</td>";     echo "<td>{$row['rush_tds']}</td>";     echo "<td>{$row['rec_yds']}</td>";     echo "<td>{$row['rec_tds']}</td>";     echo "<td>{$row['receptions']}</td>";     echo "<td>{$row['fumbles']}</td>";     echo "<td>{$row['total_fantasy_pts']}</td></tr>";     }     ?>     </table>          </div> </div>  <div class="tab_container">     <div id="tab3" class="tab_content">      <table cellspacing="0" cellpadding="5" border="1" width="560">     <tr style="text-align:center">     <td style="width:175px ; text-align:left">player name</td>     <td>team</td>     <td>rec yds</td>     <td>rec tds</td>     <td>rec</td>     <td>fumbles</td>     <td>tfp</td>     </tr>     <?php     $result = mysql_query("select player, team, rec_yds, rec_tds, receptions, fumbles, total_fantasy_pts ff_projections position = 'wr' order rec_yds desc;");      while($row = mysql_fetch_array($result))     {     echo "<tr style=\"text-align:center\"><td style=\"text-align:left\">{$row['player']}</td>";     echo "<td>{$row['team']}</td>";     echo "<td>{$row['rec_yds']}</td>";     echo "<td>{$row['rec_tds']}</td>";     echo "<td>{$row['receptions']}</td>";     echo "<td>{$row['fumbles']}</td>";     echo "<td>{$row['total_fantasy_pts']}</td></tr>";     }     ?>     </table>          </div> </div>  <div class="tab_container">     <div id="tab4" class="tab_content">      <table cellspacing="0" cellpadding="5" border="1" width="560">     <tr style="text-align:center">     <td style="width:175px ; text-align:left">player name</td>     <td>team</td>     <td>rec yds</td>     <td>rec tds</td>     <td>rec</td>     <td>fumbles</td>     <td>tfp</td>     </tr>     <?php     $result = mysql_query("select player, team, rec_yds, rec_tds, receptions, fumbles, total_fantasy_pts ff_projections position = 'te' order rec_yds desc;");      while($row = mysql_fetch_array($result))     {     echo "<tr style=\"text-align:center\"><td style=\"text-align:left\">{$row['player']}</td>";     echo "<td>{$row['team']}</td>";     echo "<td>{$row['rec_yds']}</td>";     echo "<td>{$row['rec_tds']}</td>";     echo "<td>{$row['receptions']}</td>";     echo "<td>{$row['fumbles']}</td>";     echo "<td>{$row['total_fantasy_pts']}</td></tr>";     }     ?>     </table>            </div> </div>  <div class="tab_container">     <div id="tab5" class="tab_content">      <table cellspacing="0" cellpadding="5" border="1" width="560">     <tr style="text-align:center">     <td style="text-align:left ; width:175px">player name</td>     <td>team</td>     <td>fg</td>     <td>extra pts</td>     <td>tfp</td>     </tr>     <?php     $result = mysql_query("select player, team, fg, extra_pts, overall_pts, total_fantasy_pts ff_projections position = 'k' order fg desc;");      while($row = mysql_fetch_array($result))     {     echo "<tr style=\"text-align:center\"><td style=\"text-align:left\">{$row['player']}</td>";     echo "<td>{$row['team']}</td>";     echo "<td>{$row['fg']}</td>";     echo "<td>{$row['extra_pts']}</td>";     echo "<td>{$row['total_fantasy_pts']}</td></tr>";     }     ?>     </table>          </div> </div>    <div class="tab_container">     <div id="tab6" class="tab_content">      <table cellspacing="0" cellpadding="5" border="1" width="560">     <tr style="text-align:center">     <td>team</td>     <td>sacks</td>     <td>int</td>     <td>def td</td>     <td>st td</td>     <td>shutouts</td>     <td>tfp</td>     </tr>     <?php     $result = mysql_query("select team, sacks, int_caught, def_td, st_td, shutouts, total_fantasy_pts ff_projections position = 'def / st' order def_td desc;");      while($row = mysql_fetch_array($result))     {     echo "<tr style=\"text-align:center\"><td>{$row['team']}</td>";     echo "<td>{$row['sacks']}</td>";     echo "<td>{$row['int_caught']}</td>";     echo "<td>{$row['def_td']}</td>";     echo "<td>{$row['st_td']}</td>";     echo "<td>{$row['shutouts']}</td>";     echo "<td>{$row['total_fantasy_pts']}</td></tr>";     }     ?>     </table>            </div> </div>       </body> </html> 

never forget sanitize entry touching database "mysql_real_escape_string();.

but seems its complaining undefined index $_post['id'];, because either nothing being sent or perhaps there naming issue being posted page.

try set static variable of 1 of values $posted_id: $posted_id = 3262732 (or known post id) see if form correctly returns.

if work review data being posted edit.php.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -