pmorrison Posted March 19, 2006 Share Posted March 19, 2006 Hi,I am trying to create an option to vote on a subject. I have created a form like so:[code]<form method="get" action="place_vote.php"><b>Please place your vote for this article<p><input type="radio" name="vote" value="1"> 1 Worst<br /><input type="radio" name="vote" value="2"> 2<br /><input type="radio" name="vote" value="3"> 3<br /><input type="radio" name="vote" value="4"> 4<br /><input type="radio" name="vote" value="5"> 5 Best<br /><br /><input type="submit" value="Vote"></b></form>[/code]However, I also want to send the value of the title of the article from the form. I added a new input[code]<input type="hidden" name="article" value=$_GET['title']>[/code]but using the title like this done not work. I know that this GET call does work because further up in the code I do the following and it works fine:[code]<?phpinclude ("phpFunctions.inc");$title = $_GET['title'];echo("<title>Article: $type</title>");?>[/code]The problem is that it sends article=%24title rather than the correct title. I dont know why this wont work, so any help would be much appreciated!Cheers,Paul Quote Link to comment https://forums.phpfreaks.com/topic/5298-sending-2-values-via-a-form/ Share on other sites More sharing options...
Spixxx Posted March 19, 2006 Share Posted March 19, 2006 Here's what happenedInstead of [code]<?phpinclude ("phpFunctions.inc");$title = $_GET['title'];echo("<title>Article: $type</title>");?>[/code]You supposed to use[code]<?phpinclude ("phpFunctions.inc");$title = $_POST['title'];echo("<title>Article: $type</title>");?>[/code]Because the hidden field grabbed the GET variable of title, and has it...that part works. But when you submit the form, it uses get, but instead since there are no GET variables in the voting table, just use POST.Try that, and if not try using method="post" in your formHope it helps... Quote Link to comment https://forums.phpfreaks.com/topic/5298-sending-2-values-via-a-form/#findComment-18843 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.