basically, i am taking a order manager site that was written in .net by someone else and rewriting it in php with some added features.

.net seems to have something called doPostBack, and it is generated in javascript. while im still not sure what this does entirely, it has something to do with refreshing the page and getting information in order to direct the page.

basically, this site has a feature that i really like, and i was wondering on how it is done in php. i imagine javascript will be required, but thats fine.

so the site lets you place orders. there is a drop down box that lets you select how many orders you want to see at once, ie. 10 orders, 20, 50, 100 ...

the old site would let me click on this drop down box, select my value, and then the page would automatically refresh, displaying the selected number of orders. the drop down box made a call to this doPostBack function that was written in javascript.

my question is how can i do this in php without actually creating a form and having to click "Submit"? how can i just select a value and have my page refresh, and the right value is passed from the drop down box? theres no <form> tags in this guys .net code.

the javascript function looks like this

function _doPostBack(eventTarget, eventArgument)
{
var theform;
if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1)
{ theform = document.Form1; }
else
{ theform = document.forms["Form1"]; }

theform.EVENTTARGET.value = eventTarget.split("$").join(":");
theform.
EVENTARGUMENT.value = eventArgument;
theform.submit();
}

and here is what the drop down box says
<select name="cmbRows" onchange="__doPostBack('cmbRows','')" language="javascript" id="cmbRows">....<option stuff> .....</select>

so far all i can tell is that javascript calls this function whenever it detects a change in the select box.

any help would be appreciated

thanks a lot

    ok, i figured it out.

    sorry i didnt research it enough before i posted the question.

    i stumbled across a solution that i think i can get to work. i am the worst at javascript. i hate the DOM

      <form action="" method="POST">
      <select name="number" onchange="this.form.submit();">
      <option>select number
      <option>1
      <option>2
      <option>3
      <option>4
      <option>5
      </select>
      </form>
      
      <?php
      if (isset($_POST['number'])) {echo 'you selected ' . $_POST['number'];}
      ?>
      
        Write a Reply...