[thelist] PHP and My coding ignorance

AJ McKee aj.mckee at nmtbmedia.com
Thu Aug 7 20:04:27 CDT 2003


Big thanks to David & Chris,

Thanks for the help, had a big bad brain fail and for some reason this
would not work earlier, but now does. Must be the glass of wine I had
:-)

It still does not sort out the problem if the user submits something
that is say 43 but its enough for me to work with. I can just get the
multiplier and then subtract the diference to get the values that I
need. Not elegant but hey I am no coder. 

Chris sorry about my inconsistancy but I am glad to see you saw past
that.

AJ

<?php
$divisor = 7;
$number = $_POST['UserNumber'];
if ($number % $divisor == 0) {
	echo "Number ($number) submited is a multiple of
$divisor\n<br>";
	$multiple = $number / $divisor;
	echo "$multiple x $divisor = $number\n";
	x(); // Thanks Chris
}
else {
	echo "Number ($number) submited is not a multiple of
$divisor\n<br>";
	$multiple = $number / $divisor;
	echo "$multiple x $divisor = $number\n";
	y(); 
}
?>

>-----Original Message-----
>From: thelist-bounces at lists.evolt.org 
>[mailto:thelist-bounces at lists.evolt.org] On Behalf Of David Bindel
>Sent: 07 August 2003 22:47
>To: thelist at lists.evolt.org
>Subject: RE: [thelist] PHP and My coding ignorance
>
>How's this?
>
><?php
>$divisor = 7;
>if ($number >= $divisor)
>	y();
>if ($number % $divisor)
>	$somevar = x() + z();
>else
>	x();
>?>




More information about the thelist mailing list