Clickable Submit Links with POST Variables

Discussion in 'PHP' started by Skylighter, Dec 10, 2007.

  1. #1
    I am trying to modify a shopping cart's product display page without modifying the page that receives the form data.

    Currently the shopping cart uses a standard POST form and in the action tag includes some GET variables as well. It is very basic and looks something like this:

    <form name="cart_quantity" action="http://xxx.com/page.php?prodid=1" method="post">
    <input type="radio" name="id[1]" value="1">Attribute1
    <input type="radio" name="id[1]" value="2">Attribute2
    <input type="image" src="button.gif">
    </form>
    
    PHP:
    What I would like to do is replace the form's Radio and Submit buttons with several dynamically created links:

    Currently:
    o Attribute1
    o Attribute1
    [Submit]

    I would like:
    Attribute1 <--Actual link with no submit button
    Attribute2

    The problem is that the program sends some of the variables via POST. I can not figure out how to create a clickable link that would send POST data. I do not want to modify the recipient page because it would break the program for the regular unmodified product pages.

    Since I can easily create dynamic clickable links that send GET variables, I had an idea that I could create an interim page that would accept the variables as a GET and convert them to a POST and submit again. But I can not figure out how to do an automatic submit without using javascript.

    This also seems like an inefficient way to handle the problem.

    Does anyone know how I can create clickable links that would send post data?

    Failing that, does anyone have information on how to submit without user interaction?

    Thanks in advance for your time.

    Danny
     
    Skylighter, Dec 10, 2007 IP
  2. nuketro0p3r

    nuketro0p3r Peon

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    //DEFINE URL TO YOU PHP FILE THAT WILL PROCESS YOU DATA
    $baseurl = "http://example.com/something.php?";

    //HERE REPLACE X WITH "NUMBER OF LINKS YOU WANT" - 1
    for (i = 0; i < X; i++){
    echo "<a href=$baseurl" . "prodid=$i <br> \n";
    }

    hope it helped :)
     
    nuketro0p3r, Dec 11, 2007 IP