ilikephp Posted May 19, 2010 Share Posted May 19, 2010 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... Quote Link to comment https://forums.phpfreaks.com/topic/202301-php-searchupdate-form-s/ Share on other sites More sharing options...
Sergey Popov Posted May 19, 2010 Share Posted May 19, 2010 Go ahead and post your code here, and we'll work all together to add required feature Quote Link to comment https://forums.phpfreaks.com/topic/202301-php-searchupdate-form-s/#findComment-1060789 Share on other sites More sharing options...
ilikephp Posted May 19, 2010 Author Share Posted May 19, 2010 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/202301-php-searchupdate-form-s/#findComment-1060799 Share on other sites More sharing options...
Sergey Popov Posted May 19, 2010 Share Posted May 19, 2010 From your code it looks like you were able to add the "edit" link yourself. Is editrecord.php the script you already have, or you need to create one? Quote Link to comment https://forums.phpfreaks.com/topic/202301-php-searchupdate-form-s/#findComment-1060808 Share on other sites More sharing options...
ilikephp Posted May 19, 2010 Author Share Posted May 19, 2010 the editrecord.php is already created and I can edit any record. and all my records are displayed, I need to use a search form to select the specified record only and not all of them Quote Link to comment https://forums.phpfreaks.com/topic/202301-php-searchupdate-form-s/#findComment-1060815 Share on other sites More sharing options...
Sergey Popov Posted May 19, 2010 Share Posted May 19, 2010 But you already have search form: I have a php search form ... (which is working fine) The code what you posted here is not a search form... Quote Link to comment https://forums.phpfreaks.com/topic/202301-php-searchupdate-form-s/#findComment-1060817 Share on other sites More sharing options...
ilikephp Posted May 19, 2010 Author Share Posted May 19, 2010 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> Quote Link to comment https://forums.phpfreaks.com/topic/202301-php-searchupdate-form-s/#findComment-1060819 Share on other sites More sharing options...
Sergey Popov Posted May 19, 2010 Share Posted May 19, 2010 Yes, this is a search form... but the code where you need to add the "edit" link is not presented here - there must be PHP code that returns search results, in the same file where search form is. Quote Link to comment https://forums.phpfreaks.com/topic/202301-php-searchupdate-form-s/#findComment-1060824 Share on other sites More sharing options...
ilikephp Posted May 19, 2010 Author Share Posted May 19, 2010 this is my problem, I have a search form and the previous code and I dont know how to merge them :S Quote Link to comment https://forums.phpfreaks.com/topic/202301-php-searchupdate-form-s/#findComment-1060828 Share on other sites More sharing options...
Alura Posted July 15, 2010 Share Posted July 15, 2010 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! Quote Link to comment https://forums.phpfreaks.com/topic/202301-php-searchupdate-form-s/#findComment-1086559 Share on other sites More sharing options...
runthis Posted July 15, 2010 Share Posted July 15, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/202301-php-searchupdate-form-s/#findComment-1086613 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.