All pastes #438505 Raw Edit

Unnamed

public php v1 · immutable
·published 2007-04-13 17:43 UTC
rendered paste body
// php code<?phpif ($_REQUEST['submit']) { 		$submit = "1";		switch ($_REQUEST['storage']) {		case 500:			$results['storage']['price'] = '<b>Price:</b> <font color=red>$0.50</font>';			$results['storage']['space'] = '<b>Storage:</b> <font color=blue>500 MB</font>';		break;		case 1:			$results['storage']['price'] = '<b>Price:</b> <font color=red>$1.00</font>';			$results['storage']['space'] = '<b>Storage:</b> <font color=blue>1 GIG</font>';		break;		case 2:			$results['storage']['price'] = '<b>Price:</b> <font color=red>$2.00</font>';			$results['storage']['space'] = '<b>Storage:</b> <font color=blue>2 GIG</font>';		break;		case 3:			$results['storage']['price'] = '<b>Price:</b> <font color=red>$3.00</font>';			$results['storage']['space'] = '<b>Storage:</b> <font color=blue>3 GIG</font>';		break;		case 4:			$results['storage']['price'] = '<b>Price:</b> <font color=red>$4.00</font>';			$results['storage']['space'] = '<b>Storage:</b> <font color=blue>4 GIG</font>';		break;		case 5:			$results['storage']['price'] = '<b>Price:</b> <font color=red>$5.00</font>';			$results['storage']['space'] = '<b>Storage:</b> <font color=blue>5 GIG</font>';		break;		case 10:			$results['storage']['price'] = '<b>Price:</b> <font color=red>$6.00</font>';			$results['storage']['space'] = '<b>Storage:</b> <font color=blue>10 GIG</font>';		break;		case 20:			$results['storage']['price'] = '<b>Price:</b> <font color=red>$9.00</font>';			$results['storage']['space'] = '<b>Storage:</b> <font color=blue>20 GIG</font>';		break;		case 50:			$results['storage']['price'] = '<b>Price:</b> <font color=red>$14.00</font>';			$results['storage']['space'] = '<b>Storage:</b> <font color=blue>50 GIG</font>';		break;	}	switch ($_REQUEST['bandwidth']) {		case 10:			$results['bandwidth']['price'] = '<b>Price:</b> <font color=red>$3.00</font>';			$results['bandwidth']['ammount'] = '<b>Storage:</b> <font color=blue>10 GIG</font>';		break;		case 20:			$results['bandwidth']['price'] = '<b>Price:</b> <font color=red>$4.00</font>';			$results['bandwidth']['ammount'] = '<b>Storage:</b> <font color=blue>20 GIG</font>';		break;		case 30:			$results['bandwidth']['price'] = '<b>Price:</b> <font color=red>$5.00</font>';			$results['bandwidth']['ammount'] = '<b>Storage:</b> <font color=blue>30 GIG</font>';		break;		case 40:			$results['bandwidth']['price'] = '<b>Price:</b> <font color=red>$6.00</font>';			$results['bandwidth']['ammount'] = '<b>Storage:</b> <font color=blue>40 GIG</font>';		break;		case 50:			$results['bandwidth']['price'] = '<b>Price:</b> <font color=red>$7.00</font>';			$results['bandwidth']['ammount'] = '<b>Storage:</b> <font color=blue>50 GIG</font>';		break;		case 100:			$results['bandwidth']['price'] = '<b>Price:</b> <font color=red>$10.00</font>';			$results['bandwidth']['ammount'] = '<b>Storage:</b> <font color=blue>100 GIG</font>';		break;		case 200:			$results['bandwidth']['price'] = '<b>Price:</b> <font color=red>$15.00</font>';			$results['bandwidth']['ammount'] = '<b>Storage:</b> <font color=blue>200 GIG</font>';		break;		case 500:			$results['bandwidth']['price'] = '<b>Price:</b> <font color=red>$20.00</font>';			$results['bandwidth']['ammount'] = '<b>Storage:</b> <font color=blue>500 GIG</font>';		break;	}}function results($section) {	if ($section = "storage") {		foreach ($results['storage'] as $storage_info) {			$results = $storage_info;		}	}	if ($section = "bandwidth") {		foreach ($results['bandwidth'] as $bandwidth_info) {			$results = $bandwith_info;		}	}	 return $results;}?>// calling the function	<?phpif ($submit = "1") {	echo nl2br(results(storage));	echo nl2br(results(bandwidth));}	?>// form	<form action="<?php echo $PHP_SELF; ?>" method="post">		<select name="storage">		<option value="500" selected="selected">500 MB</option>		<option value="1">1 GIG</option>		<option value="2">2 GIG</option>		<option value="3">3 GIG</option>		<option value="4">4 GIG</option>		<option value="5">5 GIG</option>		<option value="10">10 GIG</option>		<option value="20">20 GIG</option>		<option value="50">50 GIG</option>		</select>				<select name="bandwidth">		<option value="10" selected="selected">10 GIG</option>		<option value="20">20 GIG</option>		<option value="30">30 GIG</option>		<option value="40">40 GIG</option>		<option value="50">50 GIG</option>		<option value="100">100 GIG</option>		<option value="200">200 GIG</option>		<option value="500">500 GIG</option>		</select>		<input type="submit" value="Generate Quote" name="submit" /></form>// errorWarning: Invalid argument supplied for foreach() "4 times"