Friday, September 23, 2011

[WD&D] Digest for sitedesign@googlegroups.com - 16 Messages in 4 Topics

Group: http://groups.google.com/group/sitedesign/topics

    rslaing <thebassman247@gmail.com> Sep 22 03:51AM -0700 ^
     
    This is my first post so please excuse me if I am not observing
    protocol.
    I have a zencart dynamic site with a few static pages. I want to
    increase the non-dynamic pages by adding extra content pulled from the
    catalog (mainly images, prices, "add to cart" etc) that is in the
    dynamic area of the site on my server. I am not advanced enough to
    script this personally (and too old to learn), and the 3500 products
    change too often for me to even contemplate doing this manually. I
    would be grateful if anyone can point me in the right direction to do
    this.Thanks in advance
    Rob

     

    Gowtham k <gowtham.subjoin@gmail.com> Sep 21 10:45PM -0700 ^
     
    In which way the browser will understand the PHP code. As becz the PHP
    code will be compiled at server itself.

     

    Olivier Florence <oli.florence@gmail.com> Sep 22 08:07AM +0100 ^
     
    PHP (like ASP, JSP, cold fusion etc) is a sever side language, the browser
    does not deal with it.
     
    When a user is on a website, he/she clicks on a link requesting a page. The
    request is sent from the browser to the server. If the page uses PHP then
    the server execute the script (which generally communicates with a database
    or compile the HTML returns) and generates an HTML page which is sent to the
    browser.
     
    That's the beauty of server side scripting, you don't have to worry about
    what type of browser is used.
     
    Hope this answers your query
     
    Olivier
     
     
     
     
     
    --
    Olivier Florence
    oli.florence@gmail.com
    www.flowebdesign.ie
    I am on Linked In <http://www.linkedin.com/in/olivierflorence>!
    Follow us on Facebook <https://www.facebook.com/flowebdesign>

     

    Liam Kenneth <liam.kenneth89@gmail.com> Sep 22 08:45AM +0100 ^
     
    do you have WAMP installed? use that as a local server to test php scripts
    locally.
     

     

    gowtham subjoin <gowtham.subjoin@gmail.com> Sep 22 03:34PM +0530 ^
     
    Thanks olivier... Liam , i'm using XAMPP as a local host in windows.
    I've installed along with MYSQL and Filezilla . I need to know
    detail about those , as becz i'm selflearner
     

     

    Liam Kenneth <liam.kenneth89@gmail.com> Sep 22 11:07AM +0100 ^
     
    Join the club Im a noob with PHP at the moment!
     
    On Thu, Sep 22, 2011 at 11:04 AM, gowtham subjoin <gowtham.subjoin@gmail.com

     

    gowtham subjoin <gowtham.subjoin@gmail.com> Sep 22 04:14PM +0530 ^
     
    I'm too striving for a good moment with you guys...

     

    Liam Kenneth <liam.kenneth89@gmail.com> Sep 22 01:04AM -0700 ^
     
    Hi all I hope there are some PHP wizards here as im stuck. Im learning
    php threw a book but thought I would try make something by myself to
    learn more.
     
    I decided to make a simple banking script which shows your balance
    which starts at zero. I have an input where you put the amount you
    want to deposit then I add the deposit variable to the balance
    variable then echo balance which should show the amount you deposited
    but for some reason $deposit + $balance is not working.
     
    Can any one help please :)
     
    <!doctype>
    <html>
    <head>
    <title>PHP test</title>
    </head>
    <body>
    <h1>Piggy Bank</h1>
    <?php
    $balance = 0.00;
     
    if (isset($_POST['submitted'])) {
     
    $deposit = $_POST['deposit'];
     
    number_format($deposit) + $balance;
    }
     
     
    echo $deposit; // checking to see I am getting the data from the input
    ?>
    <form action="index.php" method="post">
    <p>Deposit: <input type="text" name="deposit" /><input type="submit"
    value="deposit" /></p>
    <input type="hidden" name="submitted" value="TRUE" />
    </form>
     
    <p>Balance:<?php echo "£" . number_format($balance); ?> </p>
    </body>
    </html>

     

    Olivier Florence <oli.florence@gmail.com> Sep 22 09:10AM +0100 ^
     
    you are not assigning this to any variable:
    number_format($deposit) + $balance;
     
    shouldn't it be $balance = number_format($deposit) + $balance;
     
     
     
    --
    Olivier Florence
    oli.florence@gmail.com
    www.flowebdesign.ie
    I am on Linked In <http://www.linkedin.com/in/olivierflorence>!
    Follow us on Facebook <https://www.facebook.com/flowebdesign>

     

    Liam Kenneth <liam.kenneth89@gmail.com> Sep 22 09:33AM +0100 ^
     
    yeah that works but its not adding the balance to the new deposit amount it
    just displays the deposit amount.
     
    Thanks
     

     

    Liam Kenneth <liam.kenneth89@gmail.com> Sep 22 09:36AM +0100 ^
     
    do you think it could be because im resetting $balance at the top of the
    script? $balance = 0.00;
     

     

    Olivier Florence <oli.florence@gmail.com> Sep 22 10:08AM +0100 ^
     
    $balance is a variable so it is resets eveytime the page is refresh and
    submitting the form will refresh the page so your script will always take
    what ever is passed on by the form and add 0 to it.
     
    If you want to add to a new balance every time then that balance has to be
    stored somewhere, in a database would seem the logical thing. For the
    purpose of the exercise you could store the balance in a cookie or pass the
    new balance to a form field and instead of reset $balance to 0 you collect
    it from the form
     
     
     
     
     
    --
    Olivier Florence
    oli.florence@gmail.com
    www.flowebdesign.ie
    I am on Linked In <http://www.linkedin.com/in/olivierflorence>!
    Follow us on Facebook <https://www.facebook.com/flowebdesign>

     

    Liam Kenneth <liam.kenneth89@gmail.com> Sep 22 10:25AM +0100 ^
     
    cool any quick tutorial on how to set a cookie or add the balance to the
    form? thanks
     
    On Thu, Sep 22, 2011 at 10:08 AM, Olivier Florence

     

    Olivier Florence <oli.florence@gmail.com> Sep 22 10:33AM +0100 ^
     
    the easiest is to the form (note this is just for the test you are doing,
    this is not reliable or safe if you were to do anything financial)
     
    Just set a form field called balance, feed it with your php variable
    balance. Set that variable to 0 if the form is not submitted and to the form
    post if the form is submitted, you are already doing this for your other
    post variable
     
     
     
    --
    Olivier Florence
    oli.florence@gmail.com
    www.flowebdesign.ie
    I am on Linked In <http://www.linkedin.com/in/olivierflorence>!
    Follow us on Facebook <https://www.facebook.com/flowebdesign>

     

    Binaek Sarkar <binaek89@gmail.com> Sep 22 03:19PM +0530 ^
     
    setcookie("balance",<the value as string>);
     
    When received:
     
    if (isset($_COOKIE("balance")){
    $balance = $_COOKIE['balance'];
    }
    ...
     
    This should serve your purpose
     
    Regards
    Binaek Sarkar
    Foundation
    http://www.foundation.net.in/
     

     

--
You received this because you are subscribed to the "Web Design and Development" group at Google Groups. Messages are prefixed with [WD&D] in the subject. No spam is allowed. Be civil, be professional; try to be helpful & mind your netiquette. All posts are Copyright the original author and the Web Design and Development group. No reproduction of this content is allowed in any electronic or printed form outside the group at Google Groups and the http://www.WDaDg.org website. Any unauthorized use of our copy constitutes illegal Copyright infringement and may well be prosecuted to the full extent of the law. Digital Signature: $©"[W|D|&|D]g"|^|!SiteDesign@GG||#%$
To post to this group, email SiteDesign@googlegroups.com
To unsubscribe, email SiteDesign-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/SiteDesign?hl=en

No comments:

Post a Comment