Witam,
mam problem z przesłaniem zmiennej do formy, zmiennej $row('id') do contentForm Co robię źlę albo jak to inaczej zrobić/przesłać ?

  1.  
  2. <script type="text/javascript">
  3.  
  4. var messageDelay = 2000; // How long to display status messages (in milliseconds)
  5.  
  6. // Init the form once the document is ready
  7. $( init );
  8.  
  9.  
  10. // Initialize the form
  11.  
  12. function init() {
  13.  
  14. // Hide the form initially.
  15. // Make submitForm() the form's submit handler.
  16. // Position the form so it sits in the centre of the browser window.
  17. $('#contactForm').hide().submit( submitForm ).addClass( 'positioned' );
  18.  
  19. // When the "Send us an email" link is clicked:
  20. // 1. Fade the content out
  21. // 2. Display the form
  22. // 3. Move focus to the first field
  23. // 4. Prevent the link being followed
  24.  
  25. $('a[href="#contactForm"]').click( function() {
  26. $('#content').fadeTo( 'slow', .2 );
  27. $('#contactForm').fadeIn( 'slow', function() {
  28. $('#senderName').focus();
  29. } )
  30.  
  31. return false;
  32. } );
  33.  
  34. // When the "Cancel" button is clicked, close the form
  35. $('#cancel').click( function() {
  36. $('#contactForm').fadeOut();
  37. $('#content').fadeTo( 'slow', 1 );
  38. } );
  39.  
  40. // When the "Escape" key is pressed, close the form
  41. $('#contactForm').keydown( function( event ) {
  42. if ( event.which == 27 ) {
  43. $('#contactForm').fadeOut();
  44. $('#content').fadeTo( 'slow', 1 );
  45. }
  46. } );
  47.  
  48. }
  49.  
  50.  
  51. // Submit the form via Ajax
  52.  
  53. function submitForm() {
  54. var contactForm = $(this);
  55.  
  56. // Are all the fields filled in?
  57.  
  58. if ( !$('#senderName').val() || !$('#senderEmail').val() || !$('#message').val() ) {
  59.  
  60. // No; display a warning message and return to the form
  61. $('#incompleteMessage').fadeIn().delay(messageDelay).fadeOut();
  62. contactForm.fadeOut().delay(messageDelay).fadeIn();
  63.  
  64. } else {
  65.  
  66. // Yes; submit the form to the PHP script via Ajax
  67.  
  68. $('#sendingMessage').fadeIn();
  69. contactForm.fadeOut();
  70.  
  71. $.ajax( {
  72. url: contactForm.attr( 'action' ) + "?ajax=true",
  73. type: contactForm.attr( 'method' ),
  74. data: contactForm.serialize(),
  75. success: submitFinished
  76. } );
  77. }
  78.  
  79. // Prevent the default form submission occurring
  80. return false;
  81. }
  82.  
  83.  
  84. // Handle the Ajax response
  85.  
  86. function submitFinished( response ) {
  87. response = $.trim( response );
  88. $('#sendingMessage').fadeOut();
  89.  
  90. if ( response == "success" ) {
  91.  
  92. // Form submitted successfully:
  93. // 1. Display the success message
  94. // 2. Clear the form fields
  95. // 3. Fade the content back in
  96.  
  97. $('#successMessage').fadeIn().delay(messageDelay).fadeOut();
  98. $('#senderName').val( "" );
  99. $('#senderEmail').val( "" );
  100. $('#message').val( "" );
  101.  
  102. $('#content').delay(messageDelay+500).fadeTo( 'slow', 1 );
  103.  
  104. } else {
  105.  
  106. // Form submission failed: Display the failure message,
  107. // then redisplay the form
  108. $('#failureMessage').fadeIn().delay(messageDelay).fadeOut();
  109. $('#contactForm').delay(messageDelay+500).fadeIn();
  110. }
  111. }
  112. function send(x)
  113. {
  114. window.location.href="#contactForm?id="+x;
  115. }
  116. </script>
  117.  
  118.  
  119. </head>
  120. <body id="index">
  121. <div id="pagewrap">
  122. <div id="search">
  123. <label for="filter">Filter</label> <input type="text" name="filter" value="" id="filter" />
  124. </div>
  125. <div id="body">
  126. <?php
  127. require 'config.php';
  128.  
  129. $query = mysql_query('SELECT * FROM `user` ORDER BY `id`');
  130.  
  131. echo '<center><table id="tab" id="resultTable" width="600">
  132.  
  133. <thead>
  134. <tr><th>Login</th> <th>Imie</th> <th>Nazwisko</th><th>Email</th> <th>Status</th><th>Akcja</th><th>Usuń</th></tr>
  135.  
  136. </thead>
  137. ';
  138.  
  139. echo '<tbody>';
  140. while($res = mysql_fetch_assoc($query))
  141. {
  142. echo PHP_EOL . '<tr id="row'. $res['id'] .'">';
  143. echo '<td> FNS-'. $res['id'] .'</td>';
  144. echo '<td>'. htmlspecialchars($res['imie']) .'</td>';
  145. echo '<td>'. htmlspecialchars($res['nazwisko']) .'</td>';
  146. echo '<td><a href="#contactForm" onClick="send('.$res['id'].')">'. htmlspecialchars($res['email']) .'</a></td>';
  147. echo '<td id="statusInfo'. $res['id'] .'">'. ($res['status'] ? 'aktywny' : 'nieaktywny') .'</td>';
  148.  
  149. echo '<td>';
  150.  
  151. $buttonText = $res['status'] ? 'dezakt.' : 'aktywuj';
  152.  
  153. echo '<button class="sub" name="'. $res['id'] .'">'. $buttonText .'</button></td>
  154. <td class="delCell"><img src="/page/panel_admina/delete.png" class="del" name="'. $res['id'] .'" /></td></tr>';
  155.  
  156.  
  157. }
  158.  
  159.  
  160. echo '</tbody></table></center>';
  161.  
  162. ?>
  163.  
  164.  
  165. <form id="contactForm" action="processForm.php" method="post">
  166.  
  167. <h2>Send us an email...</h2>
  168.  
  169. <ul>
  170.  
  171. <li>
  172. <label for="senderName">Tytuł wiadomości(imię)</label>
  173. <input type="text" name="senderName" id="senderName" placeholder="Please type your name" required="required" maxlength="40" />
  174. </li>
  175.  
  176. <li>
  177. <label for="senderEmail">Your Email Address</label>
  178. <?php
  179. $dupa = $_GET['id'];
  180. print_r($dupa);
  181. $query = mysql_query("SELECT email FROM user where id='$dupa'");
  182. $myrow = mysql_fetch_array($query);
  183. $email = $myrow['email'];
  184.  
  185. echo '<input type="email" name="senderEmail" id="senderEmail" value="'.$email.'" placeholder="Please type your email address" required="required" maxlength="50" />';
  186.  
  187.  
  188.  
  189.  
  190. ?>
  191. <!--
  192. <input type="email" name="senderEmail" id="senderEmail" value="'.$zmienna.'"> placeholder="Please type your email address" required="required" maxlength="50" />
  193. </li>
  194. -->
  195. <li>
  196. <label for="message" style="padding-top: .5em;">Your Message</label>
  197. <textarea name="message" id="message" placeholder="Please type your message" required="required" cols="80" rows="10" maxlength="10000"></textarea>
  198. </li>
  199.  
  200. </ul>
  201.  
  202. <div id="formButtons">
  203. <input type="submit" id="sendMessage" name="sendMessage" value="Send Email" />
  204. <input type="button" id="cancel" name="cancel" value="Cancel" />
  205. </div>
  206.  
  207. </form>
  208.  
  209. <div id="sendingMessage" class="statusMessage"><p>Sending your message. Please wait...</p></div>
  210. <div id="successMessage" class="statusMessage"><p>Thanks for sending your message! We'll get back to you shortly.</p></div>
  211. <div id="failureMessage" class="statusMessage"><p>There was a problem sending your message. Please try again.</p></div>
  212. <div id="incompleteMessage" class="statusMessage"><p>Please complete


już sobie z tym poradziłem ale jak dodać do tego np tam gdzie wpisuje email opcję ze można wysłać do wielu czyli cos jak multiemail
jeszcze raz link do tego: http://www.elated.com/articles/slick-ajax-...orm-jquery-php/