Jump to content

shuffle

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

shuffle's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I still can't find a solution for this. Anyone?
  2. Here is my attempt at getting this working. So far no luck. I'm just gonna post the relevant code. <script> function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function searchDate(strURL) { var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('recordTable').innerHTML=req.responseText; } else { alert("An error occurred:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } </script> <form action="" method="post"> <p>Date:<input type="date" name="selectedDate" size="10" /> <input type="submit" name="submit[searchDate]" value="Recherche" onclick="searchDate('planification.php?selectedDate='+document.getElementById('selectedDate').value)" style="margin-right: 25%;" /> <div id="recordTable"> </div> planification.php $stmt->bind_param("s",$selectedDate); $stmt->execute(); //variables are binded and displayed in the same order as the select query $stmt->bind_result($a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o); $planificationTable = '<table border="1"><th>a</th><th>b</th><th>c</th> <th>d</th><th>e</th><th>f</th><th>g</th><th>h</th><th>i</th> <th>j</th><th>k</th><th>l</th><th>m</th><th>n</th> <th>o</th>'; while($stmt->fetch()) $planificationTable .= '<tr><td>' . $a . '</td><td>' . $b . '</td><td>' . $c . '</td><td>' . $d . '</td> <td>' . $e . '</td><td>' . $f . '</td><td>' . $g . '</td><td>' . $h . '</td><td>' . $i . '</td> <td>' . $j . '</td><td>' . $k . '</td><td>' . $l . '</td><td>' . $m . '</td><td>' . $n . '</td> <td>' . $o . '</td></tr>'; $planificationTable .= '</table>'; print $planificationTable;
  3. Well, I'm still not getting much further with this as i thought. If its not to much trouble can some one post some basic example code for doing this?
  4. Ok I'll try to do that. I'll have to learn more AJAX as I only have a rough understanding of it. Thanks for you help.
  5. well yeah I could do that but I don't want to reload the page. I'm looking to only refresh one part of the page for the information selected. I need javascript to do it but there is a part missing that I don't know how to do. Here is an example of what I'm trying to do. Just select different items in the dropdown-list to see what I'm talking about http://demo.koolphp.net/Examples/KoolComboBox/Advances/AutoPostback/index.php
  6. I'm still looking for a solution. Anyone got any ideas?
  7. Hello, I'm trying to create aspx's postback effect in PHP. This can be done with javascript with the use of a hidden "viewstate" (aspx generated) variable. Viewstate preserves the state of a page (input text in text boxes stay the same) when a form action has been submitted. So what I'm trying to preserves inputted/selected text and display new information based on that inputted/selected text when a form action has been submitted. Here is basic example for what I want to recreate in PHP (generated from aspx): <!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><title> Untitled Page </title></head> <body> <form name="form1" method="post" action="default.aspx" id="form1"> <div> <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /> <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /> <input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" /> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUINTEwNDE4MTBkZEUojnNucBpb9SAjxDe4Z6ZI/m7G" /> </div> <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script> <div> <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQKH453zCwKd5I/lCgKxx4CJAgLlwPXgBwKO7fe5AhVWST46gYYuNp7aSlVEEFAP5t5Y" /> </div> <div> <select name="DropDownList1" onchange="javascript:setTimeout('__doPostBack(\'DropDownList1\',\'\')', 0)" id="DropDownList1"> <option selected="selected" value="first">first</option> <option value="second">second</option> <option value="third">third</option> </select> </div> </form> </body> </html> Thanks
×
×
  • 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.