Jump to content

Recommended Posts

Hi, I have a problem that I can not fix it :S

 

I have a php search form,

it fetches the selected word from mysql and it display it,

 

if I search for: "world"

 

all fields that contains word will appear:

 

1 The world was...

2 The world is ...

 

 

(which is working fine)

 

What I want is to add a dynamic link for the founded records so I can click on them and update them.

 

like:

1 The world was...  (edit)

2 The world is ... (edit)

 

 

Any help plz!!

Thanks...

Link to comment
https://forums.phpfreaks.com/topic/202301-php-searchupdate-form-s/
Share on other sites

thx for the reply :)

 

this is the code of the find.php page:

it displays all the records in my database

 

 

<?php require_once('../../Connections/bapCon.php'); ?>
<?php
mysql_query("SET NAMES 'UTF8'");
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_bapCon, $bapCon);
$query_Recordset1 = "SELECT * FROM bap";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $bapCon) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>

<!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>  </title>
</head>

<body>
<body>
  

<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><?php do { ?>
      <table width="800" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="249" height="104"><?php echo $row_Recordset1['child_name_12']; ?></td>
            <td width="246"><a href="editrecord.php?bap_form_number_33=<?php echo $row_Recordset1['bap_form_number_33']; ?>">edit</a></td>
            <td width="305"><a href="bapCertificate.php?bap_form_number_33=<?php echo $row_Recordset1['bap_form_number_33']; ?>">شهادة</a></td>
          </tr>
                </table>
        <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?></td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

the previous code was:

when I open it in a browser it displays all the records

 

 

thix is the search form:

 

<h2>Search</h2>   
<form name="search" method="post" action="">  
Search for: 
<input type="text" name="find" /> in   
<Select NAME="field">  
<Option VALUE="child_name_12">Last Name</option>  
<Option VALUE="lname">Last Name</option>  
</Select>   
<input type="hidden" name="searching" value="yes" />  
<input type="submit" name="search" value="Search" /> </form>
</body>

  • 1 month later...

Hi - I am in the same boat at the moment, and wondered if you found out how to add your link to the search form.  I just posted a similar request, and wanted to ask if you figured it out, may I see how you did it?  If you haven't, and if I get any responses, I'll post them back on here so you can see if they solve your problem.

 

Thanks!

Ok i just read your first post but i get the jist of it

You want to edit something thats bieng fetched from an array, easy

Look up Ajax inplace editor

assign a specific key to each result for example

$query("stuff");
$id="0";
while($result=mysql_fetch_array($query)){
$id=++;
print "<a href=edit.php?id={$id} onClick=(AJAX STUFF HERE)>{$result['field']}</a>";
}

 

would output

<a href=edit.php?id=1

<a href=edit.php?id=2

<a href=edit.php?id=3

<a href=edit.php?id=4

etc.

 

When you set the ajax inplace editor to the links it uses the specific $id to edit just the one you click and sends it to another file for updating without the page changing, hope this helps at all

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.