Help

Codes here !

Moderators: macek, egami, gesf

kelvin24
New php-forum User
New php-forum User
Posts: 12
Joined: Mon Aug 13, 2012 5:11 pm

Help

Postby kelvin24 » Wed Sep 19, 2012 6:56 am

Code: Select all

 <?php
$localhost = "localhost";
$user = "root";
$password = "kelvin";
$db = "softeng";

$connect = @mysql_connect($localhost, $user, $password) or die("Could not connect to Localhost");
$db_handle = @mysql_select_db($db) or die("Could not connect to database");

echo "<center><table border='0'>";


if(isset($_POST['Dealer'])){
   echo "<td align='center'><select width='100' STYLE='width: 125px' size='0' name='dlrName'>";
   echo  "<strong>Dealer</strong><option>-- Select Dealer --</option>";
   $query = "SELECT * FROM dealer";
   
   $result = mysql_query($query) or die("Could not connect to query!");
   $numrows = mysql_num_rows($result);
   
   while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
      
   echo "<form method='post'>";
   echo "<option value=$line[dealers]>" .$line['dealers']. " </option>";
      }
   echo "<td></td>";
   echo "<td></td>";   
   echo "<td><input width='15px' type='submit' name='edtDLR' value='Edit Selected Dealer'></td>";
   echo "</form>";
   echo "</select></td>";
      if(isset($_POST['edtDLR'])){
         $sql = "SELECT * FROM dealer WHERE dealers='$_POST[dlrName]'";
         $result = mysql_query($sql) or die("Could not connect to query!");
         $dlrnumrows = mysql_num_rows($result);
            
         while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
            echo  "<tr align='center'>";
            echo  "<th align='center'>Update Dealer Name</th>";
            echo "<form method='post'>";
            echo "<td>" .$line['dealers']. " </td>";
            echo "<td>" ."<input type='password' name='pass' value='newName'>". " </td>";
            echo "<td><input width='15px' type='submit' name='updateDLR' value='Edit'></td>";
            echo "</tr>";
            echo "</form>";
         }
            echo "</tr>";
   }
   
   
}
if(isset($_POST['eol'])){
   echo "<td align='center'><select name='PIS' width='100' STYLE='width: 125px' size='0'>";
   echo  "<strong>Dealer</strong><option>-- Select Dealer --</option>";
   $query = "SELECT * FROM engineoil";
   
   $result = mysql_query($query) or die("Could not connect to query!");
   $numrows = mysql_num_rows($result);
   
   while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
      
   echo "<form method='post'>";
   echo "<option value=$line[engineoiltype]>" .$line['engineoiltype']. " </option>";
      }
   echo "<td></td>";
   echo "<td></td>";
   echo "<td width[code]=><input width='15px' type='submit' name='edtOIL' value='Edit Selected Oil Type' /></td>";[/code]
   echo "<td>";
   echo "</form>";
   echo "</select></td>";
   }
   
   
   echo "</table></center>";

?>





I'm trying to load this

Code: Select all

if(isset($_POST['edtDLR'])){
         $sql = "SELECT * FROM dealer WHERE dealers='$_POST[dlrName]'";
         $result = mysql_query($sql) or die("Could not connect to query!");
         $dlrnumrows = mysql_num_rows($result);
            
         while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
            echo  "<tr align='center'>";
            echo  "<th align='center'>Update Dealer Name</th>";
            echo "<form method='post'>";
            echo "<td>" .$line['dealers']. " </td>";
            echo "<td>" ."<input type='password' name='pass' value='newName'>". " </td>";
            echo "<td><input width='15px' type='submit' name='updateDLR' value='Edit'></td>";
            echo "</tr>";
            echo "</form>";
         }
   
form after hitting the button Edit selected dealer but it won't appear is there a problem in my code?

Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest

cron