Return to Snippet

Revision: 62885
at March 20, 2013 20:23 by haydin

Initial Code
<!-- Html Form -->

<form action="../processing/ftp.php" method="post">
<p><label for="ftp-company-name">Company</label><input type="text" name="ftp-company-name" id="ftp-company-name" /></p>
<p><label for="ftp-user-name">User Name</label><input type="text" name="ftp-user-name" id="ftp-user-name" /></p>
<p><label for="ftp-password">Password</label><input type="password" name="ftp-password" id="ftp-password" /></p>
<p><input type="submit" id="ftp-submit" class="button" value="submit" /></p>
<!-- Html Form -->
<!-- Php Form -->

    if (isset($_POST["ftp-company-name"])) {
        $company = $_POST["ftp-company-name"];
        $username = $_POST["ftp-user-name"];
        $password = $_POST["ftp-password"];
        $url = "ftp://$username:[email protected]/$company";
        header( "Location: $url" ) ;
    } else {
        // do nothing

<!-- Php Form -->

Initial URL

Initial Description
The example here is if you had a form on a website that when submitted, needed to use that information to go to a special URL where the login information was all appeneded to the URL. (ex : <a href=""> giochi online 1 </a> ) You could have the form post with method GET, but that is limited to the typical ?variable=foo&variable2=bar format.

Typical form with three bits of information that submits to a file called ftp.php

PHP file
This file reads in the POST variables (if they are set), builds the URL from them, and redirects to it. You'd probably want to clean up the POST variables for security purposes.

Initial Title
Append Login Credentials to URL

Initial Tags

Initial Language