functions.php
Código PHP:
<?php
function payment_mode()
{
global $IdPaymentMode;
global $textPaymentMode;
$row_pm = mysql_fetch_array(mysql_query("SELECT text FROM paymentmode WHERE IdPaymentMode = '$IdPaymentMode'"));
extract($row_pm);
$textPaymentMode = $text;
echo $textPaymentMode;
}
?>
Código PHP:
<label><?php echo FORMPAYMENTMODETEXT; ?>: </label>
<?php if (!$_GET['IdPaymentMode']) {?><select name="IdPaymentMode"><option value="0" selected></option><?php $query = "SELECT * FROM paymentmode"; $query2 = mysql_query($query) or die (mysql_error()); while($row = mysql_fetch_array($query2)) {printf("<option value=\"%s\">%s</option>", $row['id'], $row['text']);};?></select><?php }
else {?><?php payment_mode(); ?><?php };?>
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\Server\www\invoices\functions.php on line 6
Warning: extract() [function.extract]: First argument should be an array in D:\Server\www\invoices\functions.php on line 7