Rob Ball
Rob Ball

Reputation: 11

php form passing extra variable

My script displays a list of offers that I can either deny or approve. The problem I am having is sometimes I click deny and the offer is correctly denied but sometimes I click deny and it is incorrectly approved.

Using Live HTTP Headers I've checked the post data being sent when the offer is incorrectly approved and I see

denymes=Not+In+Downline&status=4&status=1

So the problem is that status is being sent twice.

I don't understand what is wrong. Sometimes it works correctly.

The code in question:

$list.="
    <div class=\"borderBox\" id=\"approve_ad_main".$temp[id]."\">
        <form name=\"deny".$temp[id]."\" action=\"index.php?view=account&ac=myads&adtype=ptsu&id=$temp[id]&action=approve&".$url_variables."\" method=\"post\">
        <div style=\"border:0px solid #000;padding:5px;\" valign=\"top\" colspan=\"2\">Add Denied Message : <input type=\"text\" name=\"denymes\" value=\"\" size=\"50\"><br/>
        <small>This is for displaying a message as to why the ad was denied<br/>
        Leave blank if approving the ads.</small><br/>
        <input type=\"hidden\" name=\"status\" value=\"4\">
        <input type=\"submit\" value=\"Deny\" style=\"width:150px;float:left;\">
        </form>
        <form name=\"approve".$temp[id]."\" action=\"index.php?view=account&ac=myads&adtype=ptsu&id=$temp[id]&action=approve&".$url_variables."\" method=\"post\">
        <input type=\"hidden\" name=\"status\" value=\"1\">
        <input type=\"submit\" value=\"Approve\" style=\"width:150px;float:left;margin-left:5px;\">
        </form>
        <br/><br/>

        <a href=\"$temp[target]\" target=\"_blank\">$temp[title]</a>
        <div id=\"approve_ad".$temp[id]."\">
            Username: $temp[username]<br />
            <div style=\"height: 150px; overflow: auto; border: 1px solid #c8c8c8; background-color: white; text-align: left; padding: 5 5 5 5px; color: black\">
                <b>Userid Used: </b> $temp[userid]<br />
                ".nl2br($temp[welcome_email])."
            </div>
        </div>
    </div>


Here's code from view source. Still can't figure out what's wrong.

<div class="borderBox" id="approve_ad_main1000">
    <form name="deny1000" action="index.php?view=account&ac=myads&adtype=ptsu&id=1000&action=approve&sid=27TWk0MU39VX4YhlU0Tn&sid2=28TYk&siduid=28&" method="post">
    <div style="border:0px solid #000;padding:5px;" valign="top" colspan="2">Add Denied Message : <input type="text" name="denymes" value="" size="50" /><br/>
    <small>This is for displaying a message as to why the ad was denied<br/>
    Leave blank if approving the ads.</small><br/>

    <input type="hidden" name="status" value="4" />
    <input type="submit" value="Deny" style="width:150px;float:left;" />
    </form>

    <form name="approve1000" action="index.php?view=account&ac=myads&adtype=ptsu&id=1000&action=approve&sid=27TWk0MU39VX4YhlU0Tn&sid2=28TYk&siduid=28&" method="post">
    <input type="hidden" name="status" value="1" />
    <input type="submit" value="Approve" style="width:150px;float:left;margin-left:5px;" />
    </form>
    <br/><br/>


    <a href="http://cw.nu/click?aid=9758&linkid=B18917&subid=&subid2=&subid3=&subid4=&subid5=" target="_blank">Beauty Discount Club - (submit Page &amp; Confirm Email)</a>
    <div id="approve_ad1000">
        Username: dan1190<br />
        <div style="height: 150px; overflow: auto; border: 1px solid #c8c8c8; background-color: white; text-align: left; padding: 5 5 5 5px; color: black">
            <b>Userid Used: </b> dan<br />

            dan
        </div>
    </div>
</div>

Upvotes: 1

Views: 863

Answers (1)

fully stacked geek
fully stacked geek

Reputation: 536

your input tags aren't being closed, which may cause the form close tag to be ignored.

Your current code:

<input type=\"hidden\" name=\"status\" value=\"1\">

Correct code:

<input type=\"hidden\" name=\"status\" value=\"1\" />

Because the form isn't being closed, it is counted as a single form, hence the double status.

Upvotes: 1

Related Questions