Problem with PHP script

Discussion in 'PHP' started by Kuna, Oct 24, 2009.

  1. #1
    <?php
    if(isset($_POST['submit'])){
    $name = $_POST['name'];
    $surname = $_POST['surname'];
    $email = $_POST['email'];
    
    ?>
    <div style=" margin-top:20%;">
    
    <form action="https://www.2checkout.com/checkout/purchase" method="post">
    <input type="hidden" name="sid" value="xxxxxx">
    <input type="hidden" name="quantity" value="1">
    <input type="hidden" name="product_id" value="3">
    <input type="hidden" name="demo" value="Y"/>
    <input type="hidden" name="fixed" value="Y"/>
    <input type="hidden" name="pay_method" value="PPI"/>
    <input type="hidden" name="cust_email" value="<?php echo $email?>" />
    <input type="hidden" name="cust_name" value="<?php echo $name?>" />
    <input type="hidden" name="cust_sirname" value="<?php echo $sirname?>" />
    <input type="hidden" name="x_receipt_link_url" value='http://www.mysite.com/orderconfirmation.php'>
    <input name="submit" type="image"  src="images/buy-button.jpg" value="Buy from 2CO">
    </form>
    </div>
    
    <?php
    } else {
    ?>
    
    
    
    
    <form action="payment.php" method="post" name="formcheck" id="formcheck" onsubmit="return (formCheck(this) && Validate(form,email));">
    
    <div class="tekst">*Name:</div><br>
    <input name="name" type="text" class="TextField" size="35">
    <br><br>
    <div class="tekst">*Surname:</div><br>
    <input name="surname" type="text" class="TextField" size="35">
    <br><br>
    
    <div class="tekst">*Email:</div><br>
    <input name="email" type="text" class="TextField" size="35"  id="email">
    <br><br>
    <input type="image" src="images/send-button.jpg" name="submit" value="submit">
    
    </form>
    <br>
    </div>
    <?php
    
    }
    ?>
    PHP:
    That is my script for 2CO payment. First when I open payment.php this form is showed
    <form action="payment.php" method="post" name="formcheck" id="formcheck" onsubmit="return (formCheck(this) && Validate(form,email));">
    
    <div class="tekst">*Name:</div><br>
    <input name="name" type="text" class="TextField" size="35">
    <br><br>
    <div class="tekst">*Surname:</div><br>
    <input name="surname" type="text" class="TextField" size="35">
    <br><br>
    
    <div class="tekst">*Email:</div><br>
    <input name="email" type="text" class="TextField" size="35"  id="email">
    <br><br>
    <input type="image" src="images/send-button.jpg" name="submit" value="submit">
    
    </form>
    Code (markup):
    WHen I use IE 8 and Opera I can fill that form but when I click on send form resets, instead it should open this
    <div style=" margin-top:20%;">
    
    <form action="https://www.2checkout.com/checkout/purchase" method="post">
    <input type="hidden" name="sid" value="xxxxxx">
    <input type="hidden" name="quantity" value="1">
    <input type="hidden" name="product_id" value="3">
    <input type="hidden" name="demo" value="Y"/>
    <input type="hidden" name="fixed" value="Y"/>
    <input type="hidden" name="pay_method" value="PPI"/>
    <input type="hidden" name="cust_email" value="<?php echo $email?>" />
    <input type="hidden" name="cust_name" value="<?php echo $name?>" />
    <input type="hidden" name="cust_sirname" value="<?php echo $sirname?>" />
    <input type="hidden" name="x_receipt_link_url" value='http://www.mysite.com/orderconfirmation.php'>
    <input name="submit" type="image"  src="images/buy-button.jpg" value="Buy from 2CO">
    </form>
    </div>
    Code (markup):
    .

    What is problem
     
    Kuna, Oct 24, 2009 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    use isset($_POST['submit_x']) or isset($_POST['submit_y']) instead of isset($_POST['submit']) and problem will be resolved :)
     
    mastermunj, Oct 24, 2009 IP
  3. Kuna

    Kuna Well-Known Member

    Messages:
    426
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #3
    nice trick. thanks
     
    Kuna, Oct 24, 2009 IP