Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member poker158149's Avatar
    Join Date
    Sep 2009
    Posts
    22
    Member #
    19934
    Hi everyone.

    I'm having a problem with my HTML form.

    I'm trying to make a form where a user enters his PlayStation Network ID and it sends him to this page that has all kinds of information about him on it.

    Here's the link to the page:
    http://profiles.us.playstation.com/p...isit/profiles/

    Except, after the trailing "/" is where the ID is supposed to go. Otherwise it brings you to a "404 Error" page.

    I need a form where the user enters his PSN ID in the form and it gets placed after the trailing "/" in the URL, and then takes him to that page with his ID in the URL.

    I know variables are involved with this, but I have no idea how to implement this.

    Help anyone?

  2.  

  3. #2
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    the form
    <form method='post' action='switch.php'>
    <label>Enter Your PS-ID</label>
    <input name='psid' type='text' />
    <button type='submit'>Go</button>
    </form>
    create a file named switch.php and put it in the same dirctory as the index or edit the path in action='' in the form.

    the php
    <?php
    if (isset($_POST['psid']) && !empty($_POST['psid']))
    {
    $id = strip_tags($_POST['psid']);
    header("Location: http://profiles.us.playstation.com/p...isit/profiles/$id); exit;
    }
    else
    {
    header("Location: http://profiles.us.playstation.com"); exit;
    }
    ?>
    you can edit the else statement to give the desired results if they left it blank

    while($get_it !== true){ continue; }

  4. #3
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    how are you receiving the url? is that a file by number or is the path handled another way? the reason i ask is you will want to add an error catch in case they enter the rong id.

    while($get_it !== true){ continue; }

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    717 times
    Ded ...

    You need a form action, and method ...
    Also names for each of those form variables.

    Without those things, your form won't do much of anything.


  6. #5
    Junior Member poker158149's Avatar
    Join Date
    Sep 2009
    Posts
    22
    Member #
    19934
    I don't really understand your question, Dorky.

    And I get this error when I try to run it:

    Code:
    Parse error:  syntax error, unexpected T_STRING in /home/pk158149/public_html/psnid.php on line 9
    Here is my .php page:

    Code:
    <?php
    if (isset($_POST['psnid']) && !empty($_POST['psnid']))
    {
    $id = strip_tags($_POST['psnid']);
    header("Location: http://profiles.us.playstation.com/playstation/psn/visit/profiles/$id); exit;
    }
    else
    {
    header("Location: http://profiles.us.playstation.com); exit;
    }
    ?>
    Here is my form:

    Code:
    <form method='post' action='psnid.php'>
    <label>Enter Your PSN ID</label>
    <input name='psnid' type='text' />
    <button type='submit'>Go</button>
    </form>

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    717 times
    missing quotes .... and no need for exit;

    <?php
    if (isset($_POST['psnid']) && !empty($_POST['psnid']))
    {
    $id = strip_tags($_POST['psnid']);
    header("Location: http://profiles.us.playstation.com/playstation/psn/visit/profiles/$id");
    }
    else
    {
    header("Location: http://profiles.us.playstation.com");
    }
    ?>


  8. #7
    Junior Member poker158149's Avatar
    Join Date
    Sep 2009
    Posts
    22
    Member #
    19934
    Thank you so much mlseim!

  9. #8
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    oops.

    while($get_it !== true){ continue; }

  10. #9
    Junior Member poker158149's Avatar
    Join Date
    Sep 2009
    Posts
    22
    Member #
    19934
    And thank you Dorky for the form and script in the first place.

  11. #10
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    np. sorry for the missing quote.

    while($get_it !== true){ continue; }


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:48 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com