SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Aug 2003
    Location
    IL
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    variable in form action when form creates variable

    how do i put a variable in my url (form action) when my variable isnt created until i hit the submit button?

  2. #2
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You mean you want a different form action depending on user input in the same form ?
    That won't happen, because as you say the form will be created before the input is received.

    I image there would be better alternatives to what you are trying to do.

  3. #3
    SitePoint Addict
    Join Date
    Aug 2003
    Location
    IL
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    exactly,and here's where I get confused. I do like this in the form.

    action="mypage.php?un=$un"

    and it gives me an error stating that $un hasnt been defined. And its correct, it hasn't been cause I haven't submitted the form yet.

    You see, the form creates a row in my mysql database, this row has a field with an incrementing number in it. when the form is submitted I want it to fill the fields back up with the information that was submitted and the only way I can think of is by using the incremented number that hasnt been created yet. any help is appreciated, I just can't think this thing through

  4. #4
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are created the row when the form is submitted you can get the auto increment number that is was given.
    One way is to a specific mysql function that returns the information, or alternatively you could run a new select query with your other information to get the ID of the new row.
    AFAIK you can't pass a variable in the URL with a form like that.

  5. #5
    SitePoint Wizard swdev's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post the complete form as I don;t fully understand what you are trying to achieve.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •