Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>
Code: Select all
<?php
print "<table>";
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."$i"; // item using $i as the loop counter
$item_value = $_POST[$item_name];
$amount_name = 'amount'."$i"; // amount using $i as the loop counter
$amount_value = $_POST[$amount_name];
$print_error = ""; // set print error to null
$bills = "bills.txt";
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "<td>";
print "<input type=text name=$item_name value='$item_value'>";
print " </td>";
// amount field setup
print "<td>";
print "<input type=text name=$amount_name value='$amount_value'>";
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "Amount $amount_value is not a number";
$error++;
}else{
}
print "<font color=#FF0000>$print_error</font>";
}
// end each table row
print "</td></tr>";
}
// end table
print "</table>";
// print error or total expense
if ($error > 0)
{
print "<font color=#FF0000>Error: $error</font>";
}else{
$total_expense = "$amount1" + "$amount2"+ "$amount3" + "$amount4";
if ($total_expense == 0)
{
print "Total Expenses:";
}else{
print "Total Expenses: $total_expense";
}
}
?><!-- html submit button -->
<input type="submit" name="Submit" value="Save">
</p>
<!-- end form -->
</form>
</body>
</html>ith PHP for about 3 weeks. I'm trying to clean up the addition in the following code ($total_expenses) to make room if I have to add more cells to the table by changing the $i variable. Also if I wanted to add 2 new blank rows after submitting the form for more possible entries where/how would be a good way of going about it?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>
Code: Select all
<?php
print "<table>";
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."$i"; // item using $i as the loop counter
$item_value = $_POST[$item_name];
$amount_name = 'amount'."$i"; // amount using $i as the loop counter
$amount_value = $_POST[$amount_name];
$print_error = ""; // set print error to null
$bills = "bills.txt";
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "<td>";
print "<input type=text name=$item_name value='$item_value'>";
print " </td>";
// amount field setup
print "<td>";
print "<input type=text name=$amount_name value='$amount_value'>";
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "Amount $amount_value is not a number";
$error++;
}else{
}
print "<font color=#FF0000>$print_error</font>";
}
// end each table row
print "</td></tr>";
}
// end table
print "</table>";
// print error or total expense
if ($error > 0)
{
print "<font color=#FF0000>Error: $error</font>";
}else{
$total_expense = "$amount1" + "$amount2"+ "$amount3" + "$amount4";
if ($total_expense == 0)
{
print "Total Expenses:";
}else{
print "Total Expenses: $total_expense";
}
}
?><!-- html submit button clean up the addition in the following code ($total_expenses) to make room if I have to add more cells to the table by changing the $i variable. Also if I wanted to add 2 new blank rows after submitting the form for more possible entries where/how would be a good way of going about it?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>
Code: Select all
<?php
print "e;<table>"e;;
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."e;$i"e;; // item using $i as the loop counter
$item_value = $_POSTї$item_name];
$amount_name = 'amount'."e;$i"e;; // amount using $i as the loop counter
$amount_value = $_POSTї$amount_name];
$print_error = "e;"e;; // set print error to null
$bills = "e;bills.txt"e;;
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "e;<td>"e;;
print "e;<input type=text name=$item_name value='$item_value'>"e;;
print "e;&nbsp;</td>"e;;
// amount field setup
print "e;<td>"e;;
print "e;<input type=text name=$amount_name value='$amount_value'>"e;;
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "e;Amount $amount_value is not a number"e;;
$error++;
}else{
}
print "e;<font color=#FF0000>$print_error</font>"e;;
}
// end each table row
print "e;</td></tr>"e;;
}
// end table
print "e;</table>"e;;
// print error or total expense
if ($error > 0)
{
print "e;<font color=#FF0000>Error: $error</font>"e;;
}else{
$total_expense = "e;$amount1"e; + "e;$amount2"e;+ "e;$amount3"e; + "e;$amount4"e;;
if ($total_expense == 0)
{
print "e;Total Expenses:"e;;
}else{
print "e;Total Expenses: $total_expense"eexpenses) to make room if I have to add more cells to the table by changing the $i variable. Also if I wanted to add 2 new blank rows after submitting the form for more possible entries where/how would be a good way of going about it?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>Code: Select all
<?php
print "e;<table>"e;;
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."e;$i"e;; // item using $i as the loop counter
$item_value = $_POSTї$item_name];
$amount_name = 'amount'."e;$i"e;; // amount using $i as the loop counter
$amount_value = $_POSTї$amount_name];
$print_error = "e;"e;; // set print error to null
$bills = "e;bills.txt"e;;
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "e;<td>"e;;
print "e;<input type=text name=$item_name value='$item_value'>"e;;
print "e;&nbsp;</td>"e;;
// amount field setup
print "e;<td>"e;;
print "e;<input type=text name=$amount_name value='$amount_value'>"e;;
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "e;Amount $amount_value is not a number"e;;
$error++;
}else{
}
print "e;<font color=#FF0000>$print_error</font>"e;;
}
// end each table row
print "e;</td></tr>"e;;
}
// end table
print "e;</table>"e;;
// print error or total expense
if ($error > 0)
{
print "e;<font color=#FF0000>Error: $error</font>"e;;
}else{
$total_expense = "e;$amount1"e; + "e;$amount2"e;+ "e;$amount3"e; + "e;$amount4"e;;
if ($total_expense == 0)
{
print "e;Total Expenses:"e;;
}else{
print "e;Total Expenses: $total_expense"e;;
}
}
?>
[/php:1:01a0b8lowing code ($total_expenses) to make room if I have to add more cells to the table by changing the $i variable. Also if I wanted to add 2 new blank rows after submitting the form for more possible entries where/how would be a good way of going about it?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>Code: Select all
<?php
print "e;<table>"e;;
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."e;$i"e;; // item using $i as the loop counter
$item_value = $_POSTї$item_name];
$amount_name = 'amount'."e;$i"e;; // amount using $i as the loop counter
$amount_value = $_POSTї$amount_name];
$print_error = "e;"e;; // set print error to null
$bills = "e;bills.txt"e;;
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "e;<td>"e;;
print "e;<input type=text name=$item_name value='$item_value'>"e;;
print "e;&nbsp;</td>"e;;
// amount field setup
print "e;<td>"e;;
print "e;<input type=text name=$amount_name value='$amount_value'>"e;;
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "e;Amount $amount_value is not a number"e;;
$error++;
}else{
}
print "e;<font color=#FF0000>$print_error</font>"e;;
}
// end each table row
print "e;</td></tr>"e;;
}
// end table
print "e;</table>"e;;
// print error or total expense
if ($error > 0)
{
print "e;<font color=#le but I've only been working with PHP for about 3 weeks. I'm trying to clean up the addition in the following code ($total_expenses) to make room if I have to add more cells to the table by changing the $i variable. Also if I wanted to add 2 new blank rows after submitting the form for more possible entries where/how would be a good way of going about it?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>Code: Select all
<?php
print "<table>";
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."$i"; // item using $i as the loop counter
$item_value = $_POST[$item_name];
$amount_name = 'amount'."$i"; // amount using $i as the loop counter
$amount_value = $_POST[$amount_name];
$print_error = ""; // set print error to null
$bills = "bills.txt";
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "<td>";
print "<input type=text name=$item_name value='$item_value'>";
print " </td>";
// amount field setup
print "<td>";
print "<input type=text name=$amount_name value='$amount_value'>";
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "Amount $amount_value is not a number";
$error++;
}else{
}
print "<font color=#FF0000>$print_error</font>";
}
// end each table row
print "</td></tr>";
}
// end table
print "</table>";
// print error or total expense
if ($error > 0)
{
print "<font color=#FF0000>Error: $error</font>";
}else{
$total_expense = "$amount1" + "$amount2"+ "$amount3" + "$amount4";
if ($total_expense == 0)
{
print "Total Expenses:";
}else{
print "Total Expenses: $total_expense";
}
}
?><!-- html submit button -->
<input type="submit" name="Submit" value="Save">
</p>
<!-- end form -->
<le but I've only been working with PHP for about 3 weeks. I'm trying to clean up the addition in the following code ($total_expenses) to make room if I have to add more cells to the table by changing the $i variable. Also if I wanted to add 2 new blank rows after submitting the form for more possible entries where/how would be a good way of going about it?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>
Code: Select all
<?php
print "<table>";
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."$i"; // item using $i as the loop counter
$item_value = $_POST[$item_name];
$amount_name = 'amount'."$i"; // amount using $i as the loop counter
$amount_value = $_POST[$amount_name];
$print_error = ""; // set print error to null
$bills = "bills.txt";
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "<td>";
print "e;<input type=text name=$item_name value='$item_value'>"e;;
print "e;&nbsp;</td>"e;;
// amount field setup
print "e;<td>"e;;
print "e;<input type=text name=$amount_name value='$amount_value'>"e;;
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "e;Amount $amount_value is not a number"e;;
$error++;
}else{
}
print "e;<font color=#FF0000>$print_error</font>"e;;
}
// end each table row
print "e;<amp;gt;
<th width="162"><font color="#0033FF">Amount</font></th>
</table>Code: Select all
<?php
print "<table>";
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."$i"; // item using $i as the loop counter
$item_value = $_POST[$item_name];
$amount_name = 'amount'."$i"; // amount using $i as the loop counter
$amount_value = $_POST[$amount_name];
$print_error = ""; // set print error to null
$bills = "bills.txt";
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "<td>";
print "<input type=text name=$item_name value='$item_value'>";
print " </td>";
// amount field setup
print "<td>";
print "<input type=text name=$amount_name value='$amount_value'>";
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "Amount $amount_value is not a number";
$error++;
}else{
}
print "<font color=#FF0000>$print_error</font>";
}
// end each table row
print "</td></tr>";
}
// end table
print "</table>";
// print error or total expense
if ($error > 0)
{
print "<font color=#FF0000>Error: $error</font>";
}else{
$total_expense = "$amount1" + "$amount2"+ "$amount3" + "$amount4";
if ($total_expense == 0)
{
print "Total Expenses:";
}else{
print "Total Expenses: $total_expense";
}
}
?><!-- html submit button -->
<input type="submit" name="Submit" value="Save">
</p>
<!-- end form -->
</form>
</body>
</html>mp;quote;;
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."$i"; // item using $i as the loop counter
$item_value = $_POST[$item_name];
$amount_name = 'amount'."$i"; // amount using $i as the loop counter
$amount_value = $_POST[$amount_name];
$print_error = ""; // set print error to null
$bills = "e;bills.txt"e;;
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "e;<td>"e;;
print "e;<input type=text name=$item_name value='$item_value'>"e;;
print "e;&nbsp;</td>"e;;
// amount field setup
print "e;<td>"e;;
print "e;<input type=text name=$amount_name value='$amount_value'>"e;;
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in ao clean up the addition in the following code ($total_expenses) to make room if I have to add more cells to the table by changing the $i variable. Also if I wanted to add 2 new blank rows after submitting the form for more possible entries where/how would be a good way of going about it?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>
Code: Select all
<?php
print "e;<table>"e;;
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."e;$i"e;; // item using $i as the loop counter
$item_value = $_POSTї$item_name];
$amount_name = 'amount'."e;$i"e;; // amount using $i as the loop counter
$amount_value = $_POSTї$amount_name];
$print_error = "e;"e;; // set print error to null
$bills = "e;bills.txt"e;;
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "e;<td>"e;;
print "e;<input type=text name=$item_name value='$item_value'>"e;;
print "e;&nbsp;</td>"e;;
// amount field setup
print "e;<td>"e;;
print "e;<input type=text name=$amount_name value='$amount_value'>"e;;
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "e;Amount $amount_value is not a number"e;;
$error++;
}else{
}
print "e;<font color=#FF0000>$print_error</font>"e;;
}
// end each table row
print "e;</td></tr>"e;;
}
// end table
print "e;</table>"e;;
// print error or total expense
if ($error > 0)
{
print "e in the following code ($total_expenses) to make room if I have to add more cells to the table by changing the $i variable. Also if I wanted to add 2 new blank rows after submitting the form for more possible entries where/how would be a good way of going about it?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>Code: Select all
<?php
print "e;<table>"e;;
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."e;$i"e;; // item using $i as the loop counter
$item_value = $_POSTї$item_name];
$amount_name = 'amount'."e;$i"e;; // amount using $i as the loop counter
$amount_value = $_POSTї$amount_name];
$print_error = "e;"e;; // set print error to null
$bills = "e;bills.txt"e;;
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "e;<td>"e;;
print "e;<input type=text name=$item_name value='$item_value'>"e;;
print "e;&nbsp;</td>"e;;
// amount field setup
print "e;<td>"e;;
print "e;<input type=text name=$amount_name value='$amount_value'>"e;;
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "e;Amount $amount_value is not a number"e;;
$error++;
}else{
}
print "e;<font color=#FF0000>$print_error</font>"e;;
}
// end each table row
print "e;</td></tr>"e;;
}
// end table
print "e;</table>"e;;
// print error or total expense
if ($error > 0)
{
print "e;<font color=#FF0000>Error: $error</font>"e;;
}else{
$total_expense = "e;$amount1"e; + "e;$amount2"e;+ "e;$amount3"e; + "e;$amount4"e;;
if ($for about 3 weeks. I'm trying to clean up the addition in the following code ($total_expenses) to make room if I have to add more cells to the table by changing the $i variable. Also if I wanted to add 2 new blank rows after submitting the form for more possible entries where/how would be a good way of going about it?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>Code: Select all
<?php
print "<table>";
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."$i"; // item using $i as the loop counter
$item_value = $_POST[$item_name];
$amount_name = 'amount'."e;$i"e;; // amount using $i as the loop counter
$amount_value = $_POSTї$amount_name];
$print_error = "e;"e;; // set print error to null
$bills = "e;bills.txt"e;;
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "e;<td>"e;;
print "e;<input type=text name=$item_name value='$item_value'>"e;;
print "e;&nbsp;</td>"e;;
// amount field setup
print "e;<td>"e;;
print "e;<input type=text name=$amount_name value='$amount_value'>"e;;
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "e;Amount $amount_value is not a number"e;;
$error++;
}else{
}
print "e;<font color=#FF0000>$print_error</font>"e;;
}
// end each table row
print "changing the $i variable. Also if I wanted to add 2 new blank rows after submitting the form for more possible entries where/how would be a good way of going about it?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>Code: Select all
<?php
print "e;<table>"e;;
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."e;$i"e;; // item using $i as the loop counter
$item_value = $_POSTї$item_name];
$amount_name = 'amount'."e;$i"e;; // amount using $i as the loop counter
$amount_value = $_POSTї$amount_name];
$print_error = "e;"e;; // set print error to null
$bills = "e;bills.txt"e;;
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "e;<td>"e;;
print "e;<input type=text name=$item_name value='$item_value'>"e;;
print "e;&nbsp;</td>"e;;
// amount field setup
print "e;<td>"e;;
print "e;<input type=text name=$amount_name value='$amount_value'>"e;;
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "e;Amount $amount_value is not a number"e;;
$error++;
}else{
}
print "e;<font color=#FF0000>$print_error</font>"e;;
}
// end each table row
print "e;</td></tr>"e;;
}
// end table
print "e;</table>"e;;
// print error or total expense
if ($error > 0)
{
print "e;<font color=#FF0000>Error: $error</font>"e;;
}else{
$total_expense = "e;$amount1"e; + "e;$amount2"e;+ "e;$amount3"e; + "e;$amount4"e;;
if ($total_expense == 0)
{
print "e;Total Expenses:"e;;
}else{
print "e;Total Expenses: $total_expense"e;;
}
}
?><!-- html submit button -->
<input type="submit" name="Submit" value="Save">
</p>
<!-- end formit?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>
Code: Select all
<?php
print "<table>";
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."e;$i"e;; // item using $i as the loop counter
$item_value = $_POSTї$item_name];
$amount_name = 'amount'."e;$i"e;; // amount using $i as the loop counter
$amount_value = $_POSTї$amount_name];
$print_error = "e;"e;; // set print error to null
$bills = "e;bills.txt"e;;
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "e;<td>"e;;
print "e;<input type=text name=$item_name value='$item_value'>"e;;
print "e;&nbsp;</td>"e;;
// amount field setup
print "e;<td>"e;;
print "e;<input type=text name=$amount_name value='$amount_value'>"e;;
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "e;Amount $amount_value is not a number"e;;
$error++;
}else{
}
print "e;<font color=#FF0000>$print_error</font>"e;;
}
// end each table row
print "e;&nly been working with PHP for about 3 weeks. I'm trying to clean up the addition in the following code ($total_expenses) to make room if I have to add more cells to the table by changing the $i variable. Also if I wanted to add 2 new blank rows after submitting the form for more possible entries where/how would be a good way of going about it?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>Code: Select all
<?php
print "<table>";
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."$i"; // item using $i as the loop counter
$item_value = $_POST[$item_name];
$amount_name = 'amount'."$i"; // amount using $i as the loop counter
$amount_value = $_POST[$amount_name];
$print_error = ""; // set print error to null
$bills = "bills.txt";
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "<td>";
print "<input type=text name=$item_name value='$item_value'>";
print "e;&nbsp;</td>"e;;
// amount field setup
print "e;<td>"e;;
print "e;<input t rows after submitting the form for more possible entries where/how would be a good way of going about it?
Thanks for any and all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>Code: Select all
<?php
print "<table>";
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."$i"; // item using $i as the loop counter
$item_value = $_POST[$item_name];
$amount_name = 'amount'."$i"; // amount using $i as the loop counter
$amount_value = $_POST[$amount_name];
$print_error = ""; // set print error to null
$bills = "bills.txt";
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "<td>";
print "<input type=text name=$item_name value='$item_value'>";
print " </td>";
// amount field setup
print "<td>";
print "<input type=text name=$amount_name value='$amount_value'>";
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "Amount $amount_value is not a number";
$error++;
}else{
}
print "<font color=#FF0000>$print_error</font>";
}
// end each table row
print "</td></tr>";
}
// end table
print "</table>";
// print error or total expense
if ($error > 0)
{
print "<font color=#FF0000>Error: $error</font>";
}else{
$total_expense = "$amount1" + "$amount2"+ "$amount3" + "$amount4";
if ($total_expense == 0)
{
print "Total Expenses:";
}else{
print "Total Expenses: $total_expense";
}
}
?><!-- html submit button -->
<input type="submit" name="Submit" value="Save">
</p>
<!-- end form -->
</form>
</body>all help.
<p></p>
<form method="post">
<table width="316">
<th width="142"><font color="#0033FF">Item</font></th>
<th width="162"><font color="#0033FF">Amount</font></th>
</table>
Code: Select all
<?php
print "<table>";
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."$i"; // item using $i as the loop counter
$item_value = $_POST[$item_name];
$amount_name = 'amount'."$i"; // amount using $i as the loop counter
$amount_value = $_POST[$amount_name];
$print_error = ""; // set print error to null
$bills = "bills.txt";
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "<td>";
print "<input type=text name=$item_name value='$item_value'>";
print " </td>";
// amount field setup
print "<td>";
print "<input type=text name=$amount_name value='$amount_value'>";
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "Amount $amount_value is not a number";
$error++;
}else{
}
print "<font color=#FF0000>$print_error</font>";
}
// end each table row
print "</td></tr>";
}
// end table
print "</table>";
// print error or total expense
if ($error > 0)
{
print "<font color=#FF0000>Error: $error</font>";
}else{
$total_expense = "$amount1" + "$amount2"+ "$amount3" + "$amount4";
if ($total_expense == 0)
{
print "Total Expenses:";
}else{
print "Total Expenses: $total_expense";
}
}
?><!-- html submit button -->
<input type="submit" name="Submit" value="Save">
</p>
<!-- end form -->
</form>
</body>
</html>
<?php
print "<table>";
//set server to display errors.
ini_set('display_errors',1);
for ($i = 1; $i <3; $i++)
{
$item_name = 'item'."$i"; // item using $i as the loop counter
$item_value = $_POST[$item_name];
$amount_name = 'amount'."$i"; // amount using $i as the loop counter
$amount_value = $_POST[$amount_name];
$print_error = ""; // set print error to null
$bills = "bills.txt";
$fp = fopen ($bills, 'w');
// Set up for table rows and columns
print '<tr>';
// item field setup
print "<td>";
print "<input type=text name=$item_name value='$item_value'>";
print " </td>";
// amount field setup
print "<td>";
print "<input type=text name=$amount_name value='$amount_value'>";
// Handle Null field
if (empty ($amount_value))
{
}else{
// Check for number in amount field
if (!is_numeric($amount_value))
{
$print_error = "Amount $amount_value is not a number";
$error++;
}else{
}
print "<font color=#FF0000>$print_error</font>";
}
// end each table row
print "</td></tr>";
}
// end table
print "</table>";
// print error or total expense
if ($error > 0)
{
print "<font color=#FF0000>Error: $error</font>";
}else{
$total_expense = "$amount1" + "$amount2"+ "$amount3" + "$amount4";
if ($total_expense == 0)
{
print "Total Expenses:";
}else{
print "Total Expenses: $total_expense";
}
}
?>
<p>
<!-- html submit button -->
<input type="submit" name="Submit" value="Save">
</p>
<!-- end form -->
</form>
</body>
</html>

