One button Per Row || One buttone for All rows ??

Codes here !

Moderators: macek, egami, gesf

User avatar
webwired
New php-forum User
New php-forum User
Posts: 26
Joined: Sat Nov 23, 2002 5:20 pm
Location: St. Louis, Missouri
Contact:

Postby webwired » Wed Dec 11, 2002 11:05 am

Here's one that I use...

Code: Select all

<center>
<?php
if(!$metode)
{
?>


<form method="post"  action="<?php $PHP_SELF ?>">
Search by
<select name="metode">
  <option selected value="field1">field1</option>
  <option value="field2">field2</option>
  <option value="field3">field3</option>
  <option value="field4">field4</option>
</select>
<input type="text" name="search" size="25"> 
<input type="submit" value="Begin Searching!!"> 
</form>


<?php
}else{
?>


<form method="post"  action="<?php $PHP_SELF ?>">
Search by
<select name="metode">
  <option selected value="field1">field1</option>
  <option value="field2">field2</option>
  <option value="field3">field3</option>
  <option value="field4">field4</option>
</select>
<input type="text" name="search" size="25"> 
<input type="submit" value="Begin Searching!!"> 
</form> 


<?
include_once "ez_sql.php";
$query = mysql_query("SELECT * FROM `table` WHERE $metode
LIKE '%$search%' LIMIT 0, 30 ");
$num_rows=mysql_num_rows($query);
while ($row  =  mysql_fetch_array($query))
      {
        $field1=$row["field1"];
        $field2=$row["field2"];
        $field3=$row["field3"];
        $field4=$row["field4"];
        $field5=$row["field5"];
         print ("
<center>
<form method=POST action=\"edit.php\">
<table width=500 cellspacing=0 cellpadding=0 border=1>
  <tr>
    <td>
<table width=500 cellspacing=0 cellpadding=0 border=0>
  <tr>
    <td><b>Field1</b></td>
    <td><input type=text name=field1 value=\"$field1\"></td>
  </tr>
  <tr>
    <td><b>Field2</b></td>
    <td><input type=text name=field2 value=\"$field2\"></td>
  </tr>
  <tr>
    <td><b>Field3</b></td>
    <td><input type=text name=field3 value=\"$field3\"></td>
  </tr>
  <tr>
    <td><b>Field4</b></td>
    <td><input type=text name=field4 value=\"$field4\"></td>
  </tr>
  <tr>
    <td colspan=2>
<input type=hidden name=field5 value=\"$field5\"></td>
  </tr>
  <tr>
    <td colspan=2>
<center><input type=\"submit\" name=\"submit\" value=\"Edit\"></center>
</form>
    </td>
  </tr>
</table>
    </td>
  </tr>
</table>
</center>
<br>
         "); 
      }
if(!$field5)
   {
      print "<center>No matches found.</center>";
         }
            else
               {
                  print"$num_rows result(s) found.";
                     }
?>


<?php
}
?>
</center>

Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest

cron