Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9257961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:16:25+00:00 2026-06-18T12:16:25+00:00

I have created an HTML web based print log that sends its form data

  • 0

I have created an HTML web based print log that sends its form data into a .CSV file using PHP. Everything is set up and working perfectly. Now, I am trying to add a new feature that when the form is submitted it multiplies the “number of copies” by the “type” which is technically the price per copy and sends the result into an additional cell in the .CSV file.

So to recap; the form sends all of the user filled data into the CSV file correctly. I would just like to add another item into the CSV file that is generated by multiplying the number of copies by the type (which is technically the price per copy) when the form is submitted.

I’m not really sure on how to go about doing this. I’m also not sure if PHP is an option. Any ideas would be greatly appreciated. For a better visual, I attached a screen shot below:

http://i47.tinypic.com/2rpz1xh.jpg

Code that is sending the form data to the CSV:

<?php

if(isset($_POST["submit"]))
{ 
    $type = trim($_POST["type"]); 
    $date = $_POST["date"]; 
    $job_number = trim($_POST["job_number"]); 
    $phase = $_POST["phase"];
    $task = $_POST["task"];
    $number_copies = $_POST["number_copies"];
    $name =  trim($_POST["name"]);
    $comment = $_POST["comment"];


    if(empty($type)||empty($date)||empty($job_number)||empty($number_copies)||empty($name))  
    { 
        header('Location: submit/unsuccessful.htm'); 
        die; 
    } 
    $cvsData = "\"$job_number\",\"$phase\",\"$task\",\"$date\",\"$comment\",\"$type\",\"$number_copies\"".PHP_EOL; 
    $fp = fopen("log.csv", "a"); 

    if($fp) 
    { 
        fwrite($fp,$cvsData); // Write information to the file 
        fclose($fp); // Close the file 
        header('Location: submit/successful.htm');

    }
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:16:26+00:00Added an answer on June 18, 2026 at 12:16 pm

    You could do it by simply multiplying your variables:

    $total_cost = $type * $number_copies;
    $cvsData = "\"$job_number\",\"$phase\",\"$task\",\"$date\",\"$comment\",\"$type\",\"$number_copies\",\"$total_cost\",".PHP_EOL;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a simple html-based web-page consisting of a form and some text,
I have created web pages where am using pixel to position various html elements.
I have created a html page in php and upon submission i validates that
Normally when you have a div created in html. You can check its width
I have an ASP.NET web form. This web form has an event handler that
I have created an application that allows users to capture information for entities based
I have created a basic shape in HTML canvas element which works fine. The
I have created a populated dropdown list in HTML. When the two dropdowns have
I have created a simple layout using the HTML div tag. I would like
I have created the following demo: http://thedrivepartnership.com/overflow.html The scrolls expand fine in FireFox /

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.