Take some text from a PHP text box

Discussion in 'Software' started by LI_Geek_95, Nov 24, 2008.

  1. LI_Geek_95

    LI_Geek_95 Post-and-Run Geek

    I want to make a PHP script that will have two textboxes.
    After you hit Submit, I want to get the first two letters from the first textbox. Then, all the text from the second, then post it to another webpage.
    First Name: Major
    Last Name: Geeks
    then after you press OK, it will go to getpw.php?pw=mageeks
    Then, I also need to know how to echo the text from the parameter.
    Sorry if i didn't explain it write.
     
  2. PC-XT

    PC-XT Master Sergeant

    basic html:
    Code:
    <form action=postpw.php method=post>Name: <input type=text name=n><br>Password: <input type=password name=pw></form>
    postpw.php:
    PHP:
    <?php
    $t
    ='getpw.php?pw='.urlencode(substr($n,0,2).$pw);
    header("Location:$t");
    echo(
    "Logging in... <a href=$t>Please click here if your browser doesn't redirect automatically</a>")
    ?>
     
  3. LI_Geek_95

    LI_Geek_95 Post-and-Run Geek

    Not exactacly. i need a code to figure out the password. i set up email addresses for everyone in my extended family, and i want this script to figure out their password. first two letters of their first name, all of their last name
     
  4. PC-XT

    PC-XT Master Sergeant

    Like this?
    PHP:
    substr($firstName,0,2).$lastName
     
  5. LI_Geek_95

    LI_Geek_95 Post-and-Run Geek

    But i want it to echo. How can I make it a button command?
    PHP:
    $name=substr($firstName,0,2).$lastName
    echo('$name')
    But how do u make it a button command?
     
    Last edited: Dec 7, 2008
  6. PC-XT

    PC-XT Master Sergeant

    A PHP file is called by a form or link. The PHP file makes the returned page.
    To make a button return a PHP page, placing it in a form on the calling page is the normal way
    Code:
    <form action=postpw.php method=post>First Name: <input type=text name=firstName><br>Last Name: <input type=text name=lastName><br><input type=submit></form>
    This form will call postpw.php when submit button is clicked. You can then have
    PHP:
    <?php
    $name
    =substr($firstName,0,2).$lastName;
    echo(
    $name);
    ?>
    in postpw.php to echo the result as the next page. If you would rather have it use only one page, you could use JavaScript instead, by placing onclick code in a button tag.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds