problem with PHP form

Discussion in 'PHP' started by saturn100, May 20, 2010.

  1. #1
    I am currently working on a site that will sell leads
    I have a script that is ment to send the leads straight to my affiliate

    However I am having problems with the form
    Basically when I submit my form
    I het a 404 error "url not found"
    The url that shows is mydomain.com/<?php echo $_SERVER['PHP_SELF']?>

    This relates i assume to the 1st few links of the form which has the code

    <form action="<?php echo $_SERVER['PHP_SELF']?>" method="POST" class="formStyle" id='leadForm'/>

    anyone know what the problem is
     
    saturn100, May 20, 2010 IP
  2. kaleshwar

    kaleshwar Peon

    Messages:
    43
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    is this
    mydomain.com/<?php echo $_SERVER['PHP_SELF']?>
    literally what shows in the browser address bar?
    If so, you don't have php on your server...
     
    kaleshwar, May 21, 2010 IP
  3. saturn100

    saturn100 Well-Known Member

    Messages:
    465
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    111
    #3
    I am getting mydomain/<?php echo $_SERVER['PHP_SELF']?>

    is showing up in the url but I have PHP on my server I have other forms on other sites
    I have also don a PHP test
     
    saturn100, May 22, 2010 IP
  4. Khusmair

    Khusmair Greenhorn

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #4
    hmm, Dear if you want to do this job on same page do one thing change that to the following code.

    <form action="FILE_NAME.php?action=done” method="POST" class="formStyle" id='leadForm'/>
    OR
    <form action="?action=done” method="POST" class="formStyle" id='leadForm'/>

    Top of the form put that code.

    <?php

    if($_REQEST[‘action’] == “done”)
    {

    // put your all php code here after submitting your from its will work.

    }
    ?>
     
    Last edited: May 26, 2010
    Khusmair, May 26, 2010 IP
  5. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #5
    if you have php running on your server, you need to have your form in .php file or any extension that php can handle
     
    gapz101, May 26, 2010 IP
  6. Khusmair

    Khusmair Greenhorn

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #6
    Yes you must need .php extension for your all files.
     
    Khusmair, May 26, 2010 IP
  7. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #7
    not really all, just the files you feel needs php processing..
     
    gapz101, May 26, 2010 IP
  8. Khusmair

    Khusmair Greenhorn

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #8
    Yes, you are right Sir on these pages you need .php extension on which pages you want to add PHP code thanks.
     
    Khusmair, May 28, 2010 IP
  9. SalmanAbbas007

    SalmanAbbas007 Peon

    Messages:
    100
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    lol loads of noobs in the world
     
    SalmanAbbas007, May 31, 2010 IP
  10. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #10
    Don't use $_SERVER['PHP_SELF'] as the forms action, as theirs a possible xss vulnerability, always sanitize or validate if your going to use it.
     
    danx10, May 31, 2010 IP