#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Columbus
    Posts
    5
    Rep Power
    0
    I am passing variables from one PHP3 page to another PHP3 page via a POST ACTION = "http://whateverpage.PHP3?id=$id&name=$name&type=$type" ... The values from text boxes pass over with no problem (id & name)...However, those in select (pull down) boxes don't pass over (type) -- they are blank ... Anybody have any ideas as to what the problem is ?

    thx,

    mlb
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    You can't set the values in the url of the action if you are also setting them in the form.

    Most systems are set up with priority of GPC (i.e. GET has highest priority, POST middle and COOKIE last) so if you set them in the action those values will take precedence over the values in the form. If the other values are coming thru, it must be because the values are preset in the script (before the form).
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Columbus
    Posts
    5
    Rep Power
    0
    What method would you recommend ? I've never used a GET or the COOKIE method ... just print hiddens and URL POST ACTIONs ... mlb

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by rod k:
    You can't set the values in the url of the action if you are also setting them in the form.

    Most systems are set up with priority of GPC (i.e. GET has highest priority, POST middle and COOKIE last) so if you set them in the action those values will take precedence over the values in the form. If the other values are coming thru, it must be because the values are preset in the script (before the form).
    [/quote]

  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Columbus
    Posts
    5
    Rep Power
    0
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by mbuglioli:
    What method would you recommend ? I've never used a GET or the COOKIE method ... just print hiddens and URL POST ACTIONs ...
    You're probably right on the other 2 fields, I did a MySQL lookup on the other 2 fields...
    mlb

    [/quote]

  8. #5
  9. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    Use POST action in the form. When you code it into a link or form action like you described (e.g. action_script.php3?var=$var&var2=$var2) that is a GET method. You described your action value as "http://whateverpage.php3?id=$id&name=$name&type=$type"

    If you do that and also have a line in the form such as:

    <input type=text name=type>

    The data entered in the form will never make it to the action script because $type is already set in the URL of the action (which is a GET type) because GET has priority over POST as the default in PHP (that can be changed but shouldn't be necessary in most cases). You shouldn't use the URL of the action to pass variables to the target script, to avoid just this type of occurance. If you have values to pass besides the form values, it is best to pass them in hidden fields.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Columbus
    Posts
    5
    Rep Power
    0
    Thanks Rod, this is really helpful ... sometimes it's really painful to find this stuff out on in practice

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by rod k:
    Use POST action in the form. When you code it into a link or form action like you described (e.g. action_script.php3?var=$var&var2=$var2) that is a GET method. You described your action value as "http://whateverpage.php3?id=$id&name=$name&type=$type"

    If you do that and also have a line in the form such as:

    <input type=text name=type>

    The data entered in the form will never make it to the action script because $type is already set in the URL of the action (which is a GET type) because GET has priority over POST as the default in PHP (that can be changed but shouldn't be necessary in most cases). You shouldn't use the URL of the action to pass variables to the target script, to avoid just this type of occurance. If you have values to pass besides the form values, it is best to pass them in hidden fields.
    [/quote]

  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Columbus
    Posts
    5
    Rep Power
    0
    PS -- I fixed the problem by doing the following (should be in Ripley's Believe It or Not):

    1) Added the field in question to the MySQL query in Update page 1 ... passed the vraible on a whatever.php3?id=$id&type=$type link ... believe it or not the type field on the next page comes up BLANK (type = ) but yet the value gets passed ... Don't ask me, but it works ... haha

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by mbuglioli:
    Thanks Rod, this is really helpful ... sometimes it's really painful to find this stuff out on in practice

    [/quote]

Similar Threads

  1. Replies: 4
    Last Post: February 13th, 2004, 03:31 PM

IMN logo majestic logo threadwatch logo seochat tools logo