teknospr Posted July 21, 2011 Share Posted July 21, 2011 Im trying to pass two variables to a page that will insert into a database some info. I can pass one but when I code it to pass two I get a wrong redirect page and an error. Here is the part of the code giving me trouble, including the get variables <?php $aid = $_GET['aid']; $page='insertvisits.php'; $urbid = $_POST['urbid']; ?> <form action="<?php echo $page."?aid=".$aid&"uid=".$urbid; ?>" method="post"> Any help will be appreciated Quote Link to comment https://forums.phpfreaks.com/topic/242592-passing-variable/ Share on other sites More sharing options...
Alex Posted July 21, 2011 Share Posted July 21, 2011 The & part of the string, so it should be in the quotes. You also need another period. Try: <?php echo $page."?aid=".$aid."&uid=".$urbid; ?> Quote Link to comment https://forums.phpfreaks.com/topic/242592-passing-variable/#findComment-1245972 Share on other sites More sharing options...
IrOnMaSk Posted July 22, 2011 Share Posted July 22, 2011 hey you will encounter problem passing variable like that <?php echo $page."?aid=".$aid."&uid=".$urbid; ?> if that variable holds lots and lots of info inside it. there's limit to how much info you can passing. but if your variable hold little info, should be fine. otherwise, your browser will freak out!!! Quote Link to comment https://forums.phpfreaks.com/topic/242592-passing-variable/#findComment-1246337 Share on other sites More sharing options...
hockey97 Posted July 23, 2011 Share Posted July 23, 2011 The code for passing should be like this: <?php echo $page."?aid=".$aid."&uid=".$urbid;?> you need an & after the first variable inbetween the 1st variable value and the 2nd variable name. and you just needed to add another period before the uid variable name being passed. Quote Link to comment https://forums.phpfreaks.com/topic/242592-passing-variable/#findComment-1246428 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.