Skip navigation
rickylcw1990
Currently Being Moderated

I need to create a formular on the web page .

Mar 25, 2013 9:51 PM

I need to create a formular on my web page like;

 

                <td align="center">$<?php echo $row_Recordset2['a100']; ?>*<?php echo $row_Recordset1['margin_100']; ?></td>

 

But the '*' is display to the web page like a text but not a function.

 
Replies
  • Sudarshan Thiagarajan
    4,000 posts
    Oct 15, 2010
    Currently Being Moderated
    Mar 25, 2013 10:14 PM   in reply to rickylcw1990

    You mean you want to hyperlink the '*'?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2013 10:43 PM   in reply to rickylcw1990

    I think it best if you give us a link to your site. The markup that you have shown should only produce a '*'. The problem may be caused elsewhere.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2013 11:19 PM   in reply to rickylcw1990

    Try

    <td align="center">$<?php echo ($row_Recordset2['a100'] * $row_Recordset1['margin_100']); ?></td>

     
    |
    Mark as:
  • Sudarshan Thiagarajan
    4,000 posts
    Oct 15, 2010
    Currently Being Moderated
    Mar 25, 2013 11:19 PM   in reply to rickylcw1990

    Your code will not 'multiply' the 2 values. It will display the 1st, a * and then the 2nd value.

     

    To be able to multiply both values, you have to create a variable and define the multiplication outside of your table. Then echo that value within your table.

     

    See this tutorial to know how to multiply values in PHP: http://www.homeandlearn.co.uk/php/php2p8.html

     
    |
    Mark as:
  • Sudarshan Thiagarajan
    4,000 posts
    Oct 15, 2010
    Currently Being Moderated
    Mar 25, 2013 11:20 PM   in reply to Sudarshan Thiagarajan

    Ben, we posted at the same time!

     

    @ricky: Ben's suggestion will work.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2013 11:28 PM   in reply to rickylcw1990

    HTML does not support mathmatical functions or any other types of calculations. Currently you are outputting values from your php script, but performing your calculation outside your script. You need to perform calculations WITHIN your script. Try

     

    <td align="center">$<?php echo $row_Recordset2['a100'] * $row_Recordset1['margin_100']; ?></td>

     

     

    EDIT: ah, a few minutes too late

     
    |
    Mark as:
  • Currently Being Moderated
    May 8, 2013 7:03 PM   in reply to rickylcw1990

    number_format((float)$number, 2, '.', '')

     
    |
    Mark as:
  • Currently Being Moderated
    May 8, 2013 8:32 PM   in reply to rickylcw1990

    <?php echo number_format((float)($row_Recordset2['a100'] * $row_Recordset1['margin_100']), 2, '.', ''); ?>

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points