Results 1 to 2 of 2

Thread: need help with an if else statement

  1. #1
    Join Date
    Feb 2011
    Thanked 0 Times in 0 Posts

    Default need help with an if else statement

    Hello community

    I am having some troubles with the following statement:


    if (isset($_POST["checkout"])) {
    //button 1 action
    echo "<form action='' name='order' method='POST' onsubmit='return ReadForm(this, true)'>";
    elseif (isset($_POST["update"])) {
    //button 2 action

    print " <br>NAME: <b>".$_POST['name']."</b><br> EMAIL: <b>".$_POST['email']."</b><br>Address: <b>".$_POST['address']."</b><br>City: <b>".$_POST['city']."</b><br>Postal Code/Zip Code: <b>".$_POST['postal']."</b><br> ";
    print "ORDER:<br/>";
    foreach ($order as $f) {
    echo $f."<br />";


    else {

    Bassically the first button should send the info to paypal, and the second button updates a list so the person can see what they have in their cart without going to paypal. The second button works fine, but checkout simply does nothing. I've been staring at this for hours and am out of ideas. If anyone knows of a solution that would be great.

    Let me know if I need to add anything else.

    Thanks in advance

  2. #2
    Join Date
    Sep 2008
    Bristol - UK
    Thanked 132 Times in 131 Posts


    Can you post all of the code?

    The code below only echoes out a form tag. Where's the actual submit button for the form?
    PHP Code:
    if (isset($_POST["checkout"])) {
    //button 1 action
    echo "<form action='' name='order' method='POST' onsubmit='return ReadForm(this, true)'>";

    Edit: Might be worth looking at the ReadForm() function. If it returns false then your form's not going to get sent off.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts