All pastes #825828 Raw Edit

Miscellany

public php v1 · immutable
#825828 ·published 2007-12-20 20:47 UTC
rendered paste body
<?php	$domains = array("domain1.com", "domain2.com", "domain3.com");	$hide = array("n", "n", "n");	$forsale = array("y", "y", "y");	$price = array(10, 20, 30);?><form method='POST' action='form.php'>	<table border='0'>		<tr><td>Domain</td><td>Hide price?</td><td>For sale?</td><td>Price</td></tr>		<?php			for($i=0;count($domains)>$i;$i++) {				echo "<tr><td>".$domains[$i]."<input type='hidden' name='domain[]' value='".$domains[$i]."'></td><td align='center'><input type='checkbox' name='hideprice[]' 								value='".$domains[$i]."'></td><td align='center'><input type='checkbox' name='forsale[]' value='".$domains[$i]."'></td><td><input type='text' name='price[]' 				value='".$price[$i]."' maxlength='6'></td></tr>";			}		?>		<tr><td>&nbsp;</td><td>&nbsp;</td><td><input type='submit' name='save' value='Save' /></td><td>&nbsp;</td></tr>	</table><br /><br /></form><?php	if( (isset($_POST['save'])) && ($_POST['domain']) && ($_POST['hideprice']) && ($_POST['forsale']) && ($_POST['price']) ) {		for($i=0;count($_POST['domain'])>$i;$i++) {			echo "Domain: ".$_POST['domain'][$i]."<br />";						if(!$_POST['hideprice'][$i]) {$_POST['hideprice'][$i]="n";} else {$_POST['hideprice'][$i]="y";}			echo "Hideprice?: ".$_POST['hideprice'][$i]."<br />";			if(!$_POST['forsale'][$i]) {$_POST['forsale'][$i]="n";} else {$_POST['forsale'][$i]="y";}			echo "For sale?: ".$_POST['forsale'][$i]."<br />";			echo "Price: ".strip_tags($_POST['price'][$i])."<br /><br />";		}	}?>