Problem with POST...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
orbdrums
Forum Commoner
Posts: 82
Joined: Wed Sep 14, 2011 11:42 pm

Problem with POST...

Post by orbdrums »

Although the php variable displays on the page properly, it is not being picked up in the subsequent page with the _POST option.
Code from source page:

Code: Select all

            <form name="frmFriendConf" action="filename.php" method="post" OnSubmit="return onFrndConf();">
                <option value="<?= $v_frnd_id; ?>"></option><?= $v_frnd_id; ?>
                <input type="submit" name="btnFriendConf" value="Confirm">
            </form>
Code from target page:

Code: Select all

    $v_frnd_id_in = $_POST['v_frnd_id'];
Any suggestions?
Thanks.
orbdrums
Forum Commoner
Posts: 82
Joined: Wed Sep 14, 2011 11:42 pm

Re: Problem with POST...

Post by orbdrums »

I should have been using the <input> tag instead of the <option> tag. I have it working now.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Problem with POST...

Post by Christopher »

<option> is a child of <select> so you can either use a <select> or change it to an <input>.
(#10850)
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Problem with POST...

Post by social_experiment »

orbdrums wrote:Any suggestions?
not directly tied to your problem but avoid short tags (<? ?>); instead use <?php ?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply