close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Adding $_PostVariable existing $Variable

Thread began 1/21/2014 6:02 pm by Kevin373660 | Last modified 1/21/2014 6:27 pm by Kevin373660 | 145 views | 1 replies

Kevin373660

Adding $_PostVariable existing $Variable

I am using DW CS3 to create php code to get the $playerScoreTotal by adding the new game score variable $_POST['playerScore'] to $oldScore the last total game score.

$playerScoreTotal = $oldScore + $_POST['playerScore'];

The php page is used to hold a swf game file. A button in the swf activates a post action to send the swf score to the php page. The game can be replayed so a combined total score needs to be created. Once I have this working I will need to then send the $playerScoreTotal value by a post from the php page to the database to update the players score total. Will the post from the swf conflict with the post from the php page?

Code below does not add the posted score to the old score. I believe that it is overwriting with the posed score value. I have worked with variables before but cannot remember how of find an appropriate example/tutorial. Do I need to create a separate math function? Use global variables? Please provide clear code example and logic. Thank you.

<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<?php

$playerScore = '';
$oldScore = $playerScore;
$playerScoreTotal = $oldScore + $_POST['playerScore'];

if (isset($_POST['playerScore']))
{
$playerScore = $_POST['playerScore'];
}
?>
Puzzle Total Score:<?php echo $playerScoreTotal; ?>Post Score:<?php echo $playerScore; ?>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...