473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

onclick show form

201 100+
it only shows for the top record. when i click on one hyper link say on record 5 it shows the form on record 14 and not on 5. i need it to show the record on all hyperlink records ids.

Do i need to create an array of forms or js?


thanks in advance for your help!

Theo Werntz II

Expand|Select|Wrap|Line Numbers
  1. <?php require_once('Connections/Del_Comments.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  35.   $insertSQL = sprintf("INSERT INTO ascomments (Id, Memo, `Date`) VALUES (%s, %s, now())",
  36.                        GetSQLValueString($_POST['Id'], "int"),
  37.                        GetSQLValueString($_POST['Memo'], "text"));
  38.  
  39.   mysql_select_db($database_Del_Comments, $Del_Comments);
  40.   $Result1 = mysql_query($insertSQL, $Del_Comments) or die(mysql_error());
  41.  
  42.  
  43. $Cfk = mysql_insert_id();
  44. $UId = '2';
  45.  
  46.   $insertSQL = sprintf("INSERT INTO asmanystatusupdate (Id, SFk, CFk, CFk0, UIdFk0, UIdFk1, Dates) VALUES (%s, %s, '$Cfk', '$Cfk', '$UId', '$UId', now())",
  47.                        GetSQLValueString($_POST['Id'], "int"),
  48.                        GetSQLValueString($_POST['SFk'], "int"));
  49.  
  50.   mysql_select_db($database_Del_Comments, $Del_Comments);
  51.   $Result1 = mysql_query($insertSQL, $Del_Comments) or die(mysql_error());
  52. }
  53.  
  54.  
  55. ?>
  56. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  57. <html xmlns="http://www.w3.org/1999/xhtml">
  58. <head>
  59. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  60. <title>Untitled Document</title>
  61. <script language="javascript">
  62. function showF(f1){
  63. if(document.getElementById(f1).style.display=='none'){
  64. document.getElementById(f1).style.display='inline';
  65. }
  66. else{document.getElementById(f1).style.display='none';}
  67. }
  68. </script>
  69.  
  70. </head>
  71.  
  72. <body>
  73. <?php
  74. //c.sfk={$row['sfk']}
  75.  
  76. mysql_select_db($database_Del_Comments, $Del_Comments);
  77.  
  78. $result = sprintf("SELECT a.Id, a.Type, 
  79. a.Dates, 
  80. a.UIdFk as UIdFk, 
  81. b.Id as Did, 
  82. b.comment as Comment, 
  83. b.dates as Day, 
  84. b.sfk as Sfk ,
  85. aes_decrypt(e.ProfileName, '$Ukey') as Name,
  86. substr(i.Path, 4) as Path
  87. FROM 
  88. asstatusupdate as a   
  89. left join asstatusdata as b 
  90. on a.id = b.sfk 
  91. right join ASWebInfo as e
  92. on e.Uidfk = a.uidfk
  93. right join ASManyAlbums as f
  94. on f.UserId=a.uidfk
  95. right join ASAlbums as g
  96. on f.AlbumId=g.Id
  97. right join ASTitle as h
  98. on g.Id=h.AlbumId
  99. right join ASData as i
  100. on h.Id=i.TitleId
  101. where a.uidfk in (select friendid from asfriends where uidfk0='1') and i.DefaultProfilePic='Y' order by dates desc;
  102. ");
  103. $statusUpdate = mysql_query($result, $Del_Comments) or die(mysql_error());
  104.  
  105. $category_id = '';
  106.  
  107. echo '<table align="center" width="40%" border="3" cellpadding="0" cellspacing="0">'; 
  108. while($row = mysql_fetch_array($statusUpdate)) {
  109.     if ($row['Id'] != $category_id) {
  110.         $category_id = $row['Id'];
  111.  
  112.         // grab table variables    
  113.             $Type = $row['Type'];
  114.         $Dates = $row['Dates'];
  115.         $Comment = $row['Comment'];
  116.         $Name = $row['Name'];
  117.         $Path = $row['Path'];
  118.         $FriendId = $row['UIdFk'];
  119.         $SFK = $row['Sfk'];
  120.  
  121.         echo '<tr>';
  122.         echo '    <td align="center">', $Name, '<br><a href="source/source.php?FriendId=',$FriendId,'"><img src="',$Path,'" height="120" width="120" align="middle" border="3" /></a></td>';
  123.         echo '    <td align="center"> ',$Dates,'<br><br>',$Type,'<br/>',$Comment,'</td>'; 
  124.         echo '    <td>',$category_id,'</td>';
  125.         echo '    <td>',$SFK,'</td>';
  126.         echo '</tr>';
  127.     } // end of if
  128.  
  129. mysql_select_db($database_Del_Comments, $Del_Comments);
  130.     $comments= sprintf("SELECT 
  131.           c.sfk as sfk1,
  132.           c.UIdFk0,
  133.           d.Memo as Memo,
  134.           d.Date as Dates1,
  135.           e.ProfileName,
  136.           substr(i.Path, 4) as Path
  137.      FROM 
  138.      asmanystatusupdate as c
  139.      left join ascomments as d     on d.id = c.cfk
  140.      right join ASWebInfo as e     on e.Uidfk = c.uidfk0
  141.      right join ASManyAlbums as f     on f.UserId=c.uidfk0
  142.      right join ASAlbums as g     on f.AlbumId=g.Id
  143.      right join ASTitle as h     on g.Id=h.AlbumId
  144.      right join ASData as i     on h.Id=i.TitleId
  145.      where c.sfk={$row['Sfk']} AND c.uidfk0 in (select friendid from asfriends where uidfk0='1') and i.DefaultProfilePic='Y'  order by dates desc;
  146.      ");
  147. $statusComments = mysql_query($comments, $Del_Comments) or die(mysql_error());
  148.     while($user_row = mysql_fetch_array($statusComments)){
  149.         // test the query
  150.         //if($row['sfk'] == $user_row['sfk']) 
  151.         {
  152.  
  153.             $Dates1 = $user_row['Dates1'];
  154.             $Memo = $user_row['Memo'];
  155.             $Name1 = $user_row['Name'];
  156.             $Path1 = $user_row['Path'];
  157.             $FriendId1 = $user_row['UIdFk0'];
  158.             $SFK1 = $user_row['sfk1'];
  159.  
  160.             //row and cell for "outer" while        
  161.             echo '<tr>';
  162.             echo '<td colspan="4" style="padding-left:1em;">';
  163.                 // display table
  164.                 echo '<table align="center" width="60%" border="3" cellpadding="0" cellspacing="0">'; 
  165.                 echo '<tr>';
  166.                 echo '    <td align="center">',$Name1,'<br/><a href="source/source.php?FriendId=',$FriendId1,'"><img src="',$Path1,'" height="120" width="120" align="middle" border="3" /></a></td>';
  167.                 echo '    <td align="center" width="40%"> ',$Dates1,'<br/><br/><br/>',$Memo,'</td>';
  168.                 echo '    <td>'.$catagory_id.'</td>'; 
  169.                 echo '    <td>',$SFK1,'</td>';
  170.                 echo '</tr>';
  171.                 echo '</table>';
  172.             //end row and cell for outer while
  173.             // echo '</td>';
  174.             // echo '</tr>';
  175.  
  176.   echo '<form action="$editFormAction" method="post" name="form1" id="form1">';
  177.   echo "<a href=\"#\" onclick=\"showF('f1');return false\" style=\"position:relative\">part 1</a><br>";
  178.   echo '<div id="f1" style="position:relative;display:none">';
  179.  
  180.   echo '<table align="center">';
  181.     echo '<tr valign="baseline">';
  182.       echo '<td nowrap="nowrap" align="right">Memo:</td>';
  183.       echo '<td><input type="text" name="Memo" value="" size="32" /></td>';
  184.     echo '</tr>';
  185.     echo '<tr valign="baseline">';
  186.       echo '<td nowrap="nowrap" align="right">&nbsp;</td>';
  187.      echo ' <td nowrap="nowrap" align="right">&nbsp;</td>';
  188.    echo ' </tr>';
  189.     echo '<tr valign="baseline">';
  190.      echo ' <td nowrap="nowrap" align="right">&nbsp;SFK:' ."$SFK1". '</td>';
  191.      echo ' <td><input type="submit" value="Insert record" /></td>';
  192.    echo ' </tr>';
  193.  echo ' </table>';
  194.   echo '<input type="hidden" name="Id" value="" />';
  195.   echo '<input type="hidden" name="Id" value="" />';
  196.  echo ' <input type="hidden" name="SFk" value="$SFK1" />';
  197.  echo ' <input type="hidden" name="MM_insert" value="form1" />';
  198.  echo '</form>';
  199. echo '</div>';
  200.         } // end of if
  201.  
  202.     } // end of while loop
  203. }// end of main loop
  204. echo '</table>';
  205. ?>
  206. </body>
  207. </html>
  208.  
  209.  
May 13 '11 #1
1 2164
acoder
16,027 Expert Mod 8TB
You need unique IDs (which you should have on a page anyway). What's happening at the moment is that it's taking the last ID which in your case would be row 14.
May 31 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: dp | last post by:
I am new to VB.NET and I have a simple question. How do I show a form from a command button click event? The code I have below is not working. I am trying to show the form frmAgent. What am I...
13
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide...
4
by: jerryyang_la1 | last post by:
I've found this script that allows be to hide/show form elements.. <script language="JavaScript"><!-- var toggle = true; function show(object) { if (document.layers && document.layers)...
1
by: radha | last post by:
hi friend Could somebody please tell me how to update an access record having two primary keys?(vb.net, asp.net, access Also how do we show a page from another page,for eg i am in page1.aspx and...
4
by: Haris Bogdanovic | last post by:
how do I refer to other form from main form so I can call its Show method ? Thanks Haris
2
by: Laurence Nuttall | last post by:
I have a .net solution that is a class library. I have a form in it called frmAbout I have a public sub, or I assume what will be a method to show the form. but when I type the frmabout name...
4
by: sameergn | last post by:
Hi, I have an image in my HTML form which has onclick() handler. There is also a submit button and a text box. Whenever text box has focus and user presses enter, the onclick() event of...
3
by: kassemn | last post by:
How to show form by a form in another project using VB.net 2003
15
by: worked | last post by:
I have a script that hides / shows form elements, and wrapped in a tab script (tab navigation). When the code is duplicated (per tab content), the hide / show function works for the first tab but...
1
by: Thammarat charoenchai. | last post by:
hi. everyone. I'm create multiple projects in 1 solution. How can to show form in others projects from default project thanks for you help & sorry about my english
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.