Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 08-19-2013, 03:03 AM
mrna3r's Avatar
mrna3r mrna3r is offline
Contributing Member
 
Join Date: 04-01-13
Location: Earth of GOD
Posts: 59
iTrader: 0 / 0%
How i can sum form variants in php?

I send my form data to a php page such as: question1 question2 . . . and more.

I wanna sum this variants but i dont know. I use this code but not work:

Code:
$total=0; for ($i=1; $i<=$countc; $i++) { $sag="question".$i; $_POST[$sag]; $total=$total+$_POST[$sag]; echo $total; // I wanna show sum of all form vars. }
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 08-23-2013, 12:07 PM
Ultrabooked's Avatar
Ultrabooked Ultrabooked is offline
Contributing Member
 
Join Date: 04-05-12
Posts: 52
iTrader: 0 / 0%
I m not sure why this doesn't work but $total is at the wrong place. It should be like this:

Code:
$total=0; for ($i=1; $i<=$countc; $i++) { $sag="question".$i; $_POST[$sag]; $total=$total+$_POST[$sag]; } echo $total; // I wanna show sum of all form vars.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mini Form, then form, then paypal? How? MissTa Coding Forum 2 03-19-2012 08:12 PM
Can't show non-modal form when modal form is displayed sypond Coding Forum 3 03-23-2007 08:31 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 12:43 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC