Hello all, I am trying to figure out a way to loop a counter offer.
example:
I have an offer for $200,000 with a tagged 3% increasment and a max offer of $250,000.
But there has already been an offer for $199,999 which is tagged with a 3% increase when out bidded with a max offer of $270,000.
Now I need to find a simple way to calculate the increasment until the minimum offer reaches its max. Or has out bid the offer.
Current High Offer = $199,999 min / $270,000 @ 3%
Counter Offer = $200,000 min / $250,000 max @ 3%
all we do is take the minimum value and times it by the percentage. But if the current high offer is over the counter offer max then stop and they are the winner. If the Counter offer max is higher than the final output of the current high offer then the counter offer wins.
any ideas?
<?
if ($_POST["Submit"] == "Submit") {
switch ($_POST["percent"]) {
case 0:
$percent_convert = "0.00";
break;
case 1:
$percent_convert = "0.03";
break;
case 2:
$percent_convert = "0.05";
break;
case 3:
$percent_convert = "0.07";
break;
case 4:
$percent_convert = "0.10";
break;
}
$offer_min = "150000";
$offer_max = "200000";
$offer_percent = "0.03";
$counter_offer_min = $_POST["counteroffermin"];
$counter_offer_max = $_POST["counteroffermax"];
if ($percent_convert == "0.00") {
// Do nothing
} else {
if ($counter_offer_min > $offer_min) {
// OFFER 1
while ($offer_min <= $offer_max) {
$newoffer1 = ($offer_min*$offer_percent);
$fight1 = ($offer_min+$newoffer1);
}
echo $fight1;
}
}
exit;
}
?>
<form name="test" method="post" action="<? echo $PHP_SELF; ?>">
Min
<input name="counteroffermin" type="text" size="10" id="counteroffermin">
Max
<input name="counteroffermax" type="text" id="counteroffermax" size="10">
<select name="percent" id="percent">
<option value="0" selected>0%</option>
<option value="1">3%</option>
<option value="2">5%</option>
<option value="3">7%</option>
<option value="4">10%</option>
</select>
<input name="Submit" type="submit" value="Submit">
</form>