Jump to content

Help with 1 form two files


seephp

Recommended Posts

Heres the code (very simple im new)

 

<html>
<head>
<title>PHPCash</title>
</head>
<body>
<form action="PHPCash1.php" action="record.php" method="POST">
Name of Product <input type="text" name="name" size="40" maxsize="100" /></p><br />
Original Price: <input type="text" name="price" size="15" maxsize="20" /></p><br />
Tax: <input type="text" name="tax" size="4" maxsize="4" /></p><br />
<input type="submit" name="submit">
</form>
<?php
if (isset ($_POST['submit'])) {
$name = "{$_POST['name']}";
$price = "{$_POST['price']}";
$tax = "{$_POST['tax']}";
$lasttax = $price * $tax;
$lastprice = $lasttax + $price;
print 'The tax of '. $name .' is <b>'. $lasttax .'</b>.';
print '<br />';
print '<br />';
print 'Final price of <b>'. $name .'</b> is <b>'. $lastprice . '</b>.';
} 
?>
</body>
</html>

 

And this is the thing that I want done in the background. I DO NOT want the user to end up on this page.

 

<html>
<head>
<title> <title>
</head>
<body>
<?php
if (isset ($_POST['submit'])) {
if ($fp = fopen ('recordedtransactions.txt', 'ab'))

$data = '
$name = "{$_POST['name']}";
$price = "{$_POST['price']}";
$tax = "{$_POST['tax']}";
$lasttax = $price * $tax;
$lastprice = $lasttax + $price;
';

fwrite ($fp, "$data\n");
fclose ($fp);
?>
</body>
</html>

 

Is there anyway to do this?

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/45207-help-with-1-form-two-files/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.