Need Quick Help, Really Simple (Not for me ;|)

Discussion in 'PHP' started by jfontestad, Feb 15, 2007.

  1. #1
    Ok I have a script that gets data from a database and when its id is called the url looks like this: index.php?id=2
    I have an input box on ?id=2 page, so a user can input a title and I need it to pass the data to a URl like
    this: index.php?id=2&title=yes

    problem is all i'm getting is this: index.php?title=yes and its not bringing me to id=2 page.

    get what i'm saying?

    heres the form i'm using that is found on index.php?id=2 and not on index.php:

    <form action="?id='.$row['id'].'" method="get">
    Custom Title: <input type="text" name="title" />
    <input type="submit" value="Submit" />
    </form>
    Code (markup):
    trying to get it to send me to index.php?id=2&title=yes
     
    jfontestad, Feb 15, 2007 IP
  2. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #2
    ahhh got it nvmd...
    forgot about POSt...

    :)
     
    jfontestad, Feb 15, 2007 IP
  3. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Add:

    <input type="hidden" name="id" value="2" />

    Change the 2 to what your wanted it to show... or whatever $row['id']...

    :)
     
    chopsticks, Feb 15, 2007 IP
  4. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #4
    now i have another dilemma.
    it crops off anything after a space. :\
    how would i make it to where it replaces spaces for lets say %20 or whateer ?
     
    jfontestad, Feb 15, 2007 IP
  5. Choller

    Choller Peon

    Messages:
    388
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
  6. ablaye

    ablaye Well-Known Member

    Messages:
    4,024
    Likes Received:
    97
    Best Answers:
    0
    Trophy Points:
    150
    #6
    Use this code:
    <form action="index.php" method="get">
    <input type="hidden" name="id" value="<?=$row['id']?>">
    Custom Title: <input type="text" name="title" />
    <input type="submit" value="Submit" />
    </form>
     
    ablaye, Feb 15, 2007 IP