Call a PHP page on click of a submit button.

Discussion in 'PHP' started by snigdharjuns, Feb 2, 2011.

  1. #1
    Hi... Am new to php. Can anybody please let me know how to call PHP page on click of a a submit button..
     
    snigdharjuns, Feb 2, 2011 IP
  2. vijayarani

    vijayarani Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    For Ex:
    <html> <body>
    <form acion="welcome.php" method="post">
    name:<input type="text" name="name"/>
    Age:<input type="text" name="age"/>
    <input type="submit" /></form></body></html>
     
    vijayarani, Feb 2, 2011 IP
  3. praateekcom

    praateekcom Member

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #3
    It actually works when you declare variables on your PHP page too.

    index.html
    Help.php
     
    praateekcom, Feb 2, 2011 IP
  4. W3Theory

    W3Theory Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4

    That would be the way to do it, but don't copy that code or someone will have a field day tearing your site and code apart.
     
    W3Theory, Feb 2, 2011 IP
  5. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yes its just the <form method="post" action"yourphpfile.php"> tag
     
    srisen2, Feb 2, 2011 IP
  6. spaceman12

    spaceman12 Active Member

    Messages:
    60
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    63
    #6
    for form submit, action="phpfile.php" shoould do. For redirect after for submission, use header('Location: yourlink')
     
    spaceman12, Feb 3, 2011 IP
  7. ankifreeze

    ankifreeze Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    it just <form action="yourpage.php" Method="post"> link to your another page or <form action="<?php $_SERVER['PHP_SELF']; ?>" method ="post"> to itself
     
    ankifreeze, Feb 3, 2011 IP
  8. W3Theory

    W3Theory Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    $_SERVER['PHP_SELF'] is subject to XSS attacks, and such. There is no point in using it.
     
    W3Theory, Feb 3, 2011 IP