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 7691573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:39:22+00:00 2026-05-31T20:39:22+00:00

I am a newbie of PHP coding, and want to do a simple math

  • 0

I am a newbie of PHP coding, and want to do a simple math example, d=(a+b)/c.

The values of a and b will be submitted by the user from a webpage containing PHP form.
The value of c is predefined in the PHP page.

When the user click “submit” in this webpage.
I expect to get the result of d in the bottom of the same webpage.

Any example code will be greatly appreciated.

  • 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-05-31T20:39:24+00:00Added an answer on May 31, 2026 at 8:39 pm
    <form method="POST" action="">
    <input type="hidden" id="c" name="c" value="10" />
    <label for="a">a: </label>
    <input type="text" id="a" name="a" /> <br />
    <label for="b">b: </label>
    <input type="text" id="b" name="b" />
    <input type="submit" />
    </form>
    <br />
    
    <?php
    if (isset($_POST["a"]) && isset($_POST["b"]) && isset($_POST["c"])) {
        if (is_numeric($_POST["a"]) && is_numeric($_POST["b"]) && is_numeric($_POST["c"])) {
            $d = ($_POST["a"] + $_POST["b"])/$_POST["c"];
            echo "d = ". $d;
        } else {
            echo "all values must be numeric!"
        }
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm completely newbie in PHP. I have tried example code from this site .
Am Newbie here.Am Beginner in php.I Create a sample Reg form.Here i want to
I am a newbie in php. I have a form with multiple checkbox values.
I am a newbie. I started php coding few days back. I want to
I'm a PHP newbie working a some scripts to display some news articles from
I'm a total newbie and want to start with php. I know some javascript
Im a Newbie to PHP and FBML(Facebook Markup Language).....so now im coding a Facebook
I'm a newbie php guy. I have 1 string output from Drupal's date module
Hi i am a newbie to php and am following this tutorial http://tutorialpot.com/2011/06/fancy-contact-form-with-inline-validation/#comment-1771 i
I'm a complete newbie to Objective-C, coming from a background of PHP, assorted dialects

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.