/    Sign up×
Community /Pin to ProfileBookmark

what am i do wrong here.. shouldn’t i be able to only say “post” once?

[code=php]if (post((‘submit’)) & $seconds = $seconds);

$inputname = $_POST[“how_many”];
$my_var = $inputname * $seconds;

$inputname = $_POST[“how_many”];
$my_min = $seconds * $inputname / 60;

$inputname = $_POST[“how_many”];
$my_hours = $inputname * $seconds / 60 / 60;

$inputname = $_POST[“how_many”];
$my_hours = $inputname * $seconds / 60 / 60;

$one_fte = $inputname * $seconds / 60 / 60 ;
if ($my_hours % 8==0);

$results = sql::clean_row(”
select
sum(quantity) as quantity,
(sum(duration_minutes) * 60) + sum(duration_seconds) as duration_seconds
from event.dbo.process_data
where process_id=$process_id”);

$seconds = floor($results[‘duration_seconds’] / $results[‘quantity’]);
$minutes = round($seconds/60 , 2);
[/code]

[code=html]<div style=”border:2px solid #a1a1a1; background:#dde; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; /* future proofing */ -khtml-border-radius: 10px; /* for old Konqueror browsers */”>
<table>
<form name=”calc” action=”<?php echo matry::here(array(‘page’=> ‘calc’)); ?>” method=”POST”>
<tr><td><?php inp(‘how_many’);?></td><td><div style=”position:relative; right: 40px;”>Raw Seconds * <?php echo $seconds; ?></div></td></tr>
<tr><td>This many Seconds: <?php echo $my_var; ?></td></tr>
<tr><td>This many Minutes: <?php echo $my_min; ?></td></tr>
<tr><td>This many Hours: <?php echo $my_hours; ?></td></tr>
<tr><td>This many FTE: <?php echo ($one_fte/8); ?></td></tr>
<tr><td><input type=”submit” value=”Calculate Totals” name=”submit” style=”border-color: #6699FF; -moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px; /* future proofing */
-khtml-border-radius: 10px; /* for old Konqueror browsers */ ” /></td></tr>
</form>
</table></div>[/code]

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@SupplementauthorNov 08.2012 — I feel it's so redundant.
Copy linkTweet thisAlerts:
@NogDogNov 08.2012 — There's no need in the code you posted to assign $_POST['how_many'] to the same variable four times. Once it's assigned, it's assigned (unless you overwrite it at some point). For that matter, there's really no functional need to assign $_POST['how_many'] to anything. These two snippets are functionally identical:
[code=php]
$foo = $_POST['foo'];
$result = $foo * $bar;
[/code]
...or...
[code=php]
$result = $_POST['foo'] * $bar;
[/code]
Copy linkTweet thisAlerts:
@Robins133Apr 01.2013 — You have to check the all code from first. Check event code separately and execute it.

Thanks

iConnect Group
×

Success!

Help @Supplement spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...