Jump to content

how to get the max value


esandra

Recommended Posts

I have several textboxes, each has the same id="orno<?php echo $y;?>"

where y is a variable that is being incremented within the loop

and I'm trying to get the maximum value that was entered in the text box orno<?php echo $y;?>

 

here is my loop

$num=100;
$nump=$num / 10;
$y=1;
for($j=1;$j<=$nump;$j++){

    for($i=1;$i<=10;$i++){
        php $y++; 

Link to comment
https://forums.phpfreaks.com/topic/219787-how-to-get-the-max-value/
Share on other sites

this is a very messed up javascript...i apologize

 

function autocomplete(y){
var orno = "orno"+y;
for(var i=1;i<=100;i++){	
var lastorno = document.getElementById(orno).value;	//gets the maximum orno 
                                                                                                //ever entered							   
var maxorno = document.write(Math.max(lastorno));	
}
alert(maxorno);
var nxtorno = (maxorno*1) + 1;
alert(nxtorno);
document.getElementById(orno).value = nxtorno;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.