473,320 Members | 2,083 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,320 software developers and data experts.

jquery form submit

pradeepjain
563 512MB
hii guys i am trying to sumit multiple forms in a single page like this.i am trying to alert yes when it come to jquery .but its not printing....plz help on this ?


Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <script src="jquery.js" type="text/javascript"></script>
  3. <script type="text/javascript">
  4. $(document).ready(function() {
  5.      $(".button1").click(function() {  
  6.         $.post("useful.php",{ brand:$("#brand").val(),model:$("model").val(),id:$("#id").val(),check:$("#check").val() } ,function(data){
  7.         alert("yes");
  8.         // $("#change").html(data);
  9.         });
  10.         });     
  11. });
  12. </script>
  13.  
  14. </head>
  15. <?php
  16.  $sqlreview = "select * from mobile_user_reviews where property1 = '". $brand ."' and property2 = '". $model ."' ";
  17.                 $resultreview = mysql_query($sqlreview);
  18.                 if(mysql_num_rows($resultreview) > 0)
  19.                 {
  20.  
  21.                         $myresult .= "<b>Reviews</b>";
  22.                         $myresult .= "<ul>";
  23.                         $j=1;
  24.                 while($row = mysql_fetch_array($resultreview))
  25.                 {
  26.                         $myresult .= "<li>";
  27.                         $myresult .= "<form name='' method='POST' action =''>";
  28.                         $helpful = gettotalhelp ($row['id']);
  29.                         $helpfulcount = gettotalhelpcount ($row['id']);
  30.                         $myresult .= "<input type='hidden' id='id' name='id' value='".$row['id']."'>";
  31.                         $myresult .= "<input type='hidden' id='model' name='model' value='".$model."'>";
  32.                         $myresult .= "<input type='hidden' id='brand' name='brand' value='".$brand."'>";
  33.                         $myresult .= "$helpfulcount of $helpful people found the following review helpful:<br/> ";
  34.                         $myresult .= getuserrealname($row['userid']).' : '.$row['review'] .' , '.date("dS, F, Y h:i a",$row['reviewedon']);
  35.                         $myresult .= "<br/>";
  36.                         $myresult .= "&nbsp; Was this review helpful to you? &nbsp; <input type ='radio' id='check' name='check' value='Yes'> YES
  37.                                         &nbsp; <input type ='radio' id='check' name='check' value='No'>NO&nbsp;<input type='submit' name='submit' class='button".$j."' value='submit'>";
  38.                         $myresult .= "<br/>";
  39.                         $myresult .= "</form>";
  40.                         $myresult .= "</li>";
  41.                         $j++;
  42.                 }
  43.                         $myresult .= "</ul>";
  44.                 }
  45.         }
  46. echo $myresult;
  47. ?>
Nov 13 '09 #1
3 3050
Markus
6,050 Expert 4TB
Your giving multiple elements the same id, this not only breaks HTML standards but is also the reason why jQuery fails. You'll have to come up with a better solution to your problem.
Nov 15 '09 #2
pradeepjain
563 512MB
But on submit only 1 id will be active rite so i tht its correct ..can u suggest some solution to this problem ...
Nov 16 '09 #3
acoder
16,027 Expert Mod 8TB
Yes, but what would "#brand", "#change", etc. refer to?

...and a suggestion: use unique IDs and pass the number, e.g. brand1, so pass 1 to the function, so that you can access the correct element.
Nov 18 '09 #4

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

Similar topics

5
by: ziobudda | last post by:
Hi, I want ask you if, for a web portal/application, is better prototype or Jquery? I don't want to innesc some type of flame, but after the announce that drupal use JQuery and that the new...
1
by: Big Moxy | last post by:
This plugin can be downloaded from http://www.phpletter.com/DOWNLOAD/. I want to add 2 fields to the sample form but do not know how. The variable s.fileElementId in the function ajaxFileUpload...
1
by: mikeh3275 | last post by:
I'm new to developing in jQuery, so I'm probably doing this wrong. I'm loading a form into a modal dialog box and I'm trying to assign a click event to the button in the form, but I can't seem to...
83
by: liketofindoutwhy | last post by:
I am learning more and more Prototype and Script.aculo.us and got the Bungee book... and wonder if I should get some books on jQuery (jQuery in Action, and Learning jQuery) and start learning about...
2
by: thj | last post by:
Hi. I've got this form that I'm trying to validate: <form id="periodForm" action="" method="post"> <p> Periode: <input id="startDate" name="startDate" type="text" size="7" value="<%=...
26
by: RobG | last post by:
Do some of the regulars here need to re-think their (sometimes strident) opposition to libraries? Both Microsoft and Nokia have announced support for jQuery. It seems to have gained quite a bit...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
3
by: aaronkmar | last post by:
Hello Bytes, I'm definitely a java newbie and have been working on an application recently and ran into strange behavior between browsers and wondered if anyone could help. I'm sure my code is...
3
by: phanimadhav | last post by:
HI experts, This is phanimadhav.I have small problem with jquery.Actually i implemented jqery for submit button conformation. But whenever i click the jquery conformation box all my...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.