Jump to content

iamjp

New Members
  • Posts

    3
  • Joined

  • Last visited

iamjp's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am 3rd yr college student and enrolled to a subject web programming and right now i am developing a web based tabulation for scoring contestants. i am having a trouble regarding on how to update a record(score) in database when the judge is giving a score to the contestant using a textbox and a button .. the problem is that it didnt read the value from an inputed textbox btw the textbox and the button was inside a do while loop so everytime a new contestant was added the image will be retrieved and another textbox and button will be placed..(to sum up, every contestant has a button and textbox for inputing the score) HERE IS THE CODE.. --------> Do while for retrieving image and textboxes do{ $count++; echo "<td style='color:#C90;font-weight:bold;font-size:12px;' >"; echo "<div id = 'hover'>"; echo "<img src = 'images/" . $result['imagename'] . "' height='300px;' width='300px;' class='img'>"; echo '<br/>'; echo $result['Name']; echo '<br/>'; echo $result['course']; echo '<br/>'; echo $result['branch']; $ID = $result['ID']; echo $result['ID']; echo '<div class = "hover">'; echo "<form method='post' style='position:relative; bottom:-120px; right:-50px;'>"; echo "<table>"; echo "<tr>"; echo "<td>"; echo "SCORE"; echo "</td>"; echo "<td>"; echo '<input type="text" name="txtscore" style="height:30px; width:50px; background-color:#923227; box-shadow:1px 1px #FFF; color:#C90;font-weight:bold; font-size:16px;"/>'; echo "</td>"; echo "<td>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; echo "<a href = 'fasttrackscw.php?id=".$ID."'>"; echo "<input type='submit' name='btn1'>"; echo "</a>"; echo '</div>'; echo "</div>"; echo "</td>"; $result=mysql_fetch_assoc($query); if($count >= $max){ //reset counter $count = 0; //end and restart echo "</tr><tr>"; } } while($result); --------> Query for updating if(isset($_POST['btn'])){ @$id =$_GET['id']; $sql = "update tblfastracks set casualwear = '$_POST[txtscore]' where contestantid = '$id'"; mysql_query($sql,$connection); }
×
×
  • 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.