ultraspoon Posted March 3, 2011 Share Posted March 3, 2011 Hellooo, I have a map on my site, a user types in there postcode, and clicks next, then a new page opens, the latitude and longitude, is passed from page one, to page two, the user then types in their details and clicks send. The details are then sent to me. But the latitude and longitude is not being sent in the email. Heres a breakdown of my code. Page one. <form method=LINK name="form1" action="apply.php"> <input name="latitude" type="hidden"/> <input type="hidden" name="longitude"/> <input type="submit" value="Submit"> </form This adds the variables to the URL and passes them to next page. Page two <?php $latitude = $_GET['latitude']; $longitude = $_GET['longitude']; ?> This grabs the variables and then. <?php echo "<input type='text' name='Longitude' value='{$latitude}'>"; ?> this places it into a text box, i then send the form just like any others, but it doesnt come through in the email. just blank any suggestions or any better way to do this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/229487-passing-varriables/ Share on other sites More sharing options...
litebearer Posted March 3, 2011 Share Posted March 3, 2011 where are you setting the values of lat & long? Quote Link to comment https://forums.phpfreaks.com/topic/229487-passing-varriables/#findComment-1182338 Share on other sites More sharing options...
ultraspoon Posted March 3, 2011 Author Share Posted March 3, 2011 in page one, from a piece of JavaScript code from a Google map. Quote Link to comment https://forums.phpfreaks.com/topic/229487-passing-varriables/#findComment-1182345 Share on other sites More sharing options...
PFMaBiSmAd Posted March 3, 2011 Share Posted March 3, 2011 You are expecting someone who is not standing right next to you to be able to tell you what is wrong with your code without knowing what your code actually is. There's at least 6 different things your code could be dong wrong that could cause this symptom. It would take seeing all your page 2 code and the code on the page that is sending the email for someone in a forum to be able to help you with what is wrong with your code. Quote Link to comment https://forums.phpfreaks.com/topic/229487-passing-varriables/#findComment-1182347 Share on other sites More sharing options...
cyberRobot Posted March 3, 2011 Share Posted March 3, 2011 The form method needs to be GET or POST. http://www.w3.org/TR/html4/interact/forms.html#h-17.13.1 Try changing <form method=LINK To <form method="get" Quote Link to comment https://forums.phpfreaks.com/topic/229487-passing-varriables/#findComment-1182348 Share on other sites More sharing options...
micmania1 Posted March 3, 2011 Share Posted March 3, 2011 Could it be because you are using name="Longitude" on the second page as opposed to name="longitude" on the first? Variable names are case sensitive so $_GET['longitude'] is not the same as $_GET['Longitude']. Quote Link to comment https://forums.phpfreaks.com/topic/229487-passing-varriables/#findComment-1182350 Share on other sites More sharing options...
ultraspoon Posted March 3, 2011 Author Share Posted March 3, 2011 Thank you all, Sorry PFMaBiSmAd, i should of posted all of my code. Thanks for the link cyberRobot, i do understand, all of the post and get methods I am using them in my code somewhere, but the user who hit it on the head was micmania1!!! Woo!! I ended up having the Variables with capital letters, changed them to lower case and it works fine. Thanks all, I should come here more often, you lot are so helpful. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/229487-passing-varriables/#findComment-1182351 Share on other sites More sharing options...
cyberRobot Posted March 3, 2011 Share Posted March 3, 2011 Huh, I guess I learned something new. I've never heard of method="link", but apparently it makes the form act as a link: http://www.htmlgoodies.com/tutorials/buttons/article.php/3478871/So-You-Want-A-Link-Button-Huh.htm I wonder if it validates... Quote Link to comment https://forums.phpfreaks.com/topic/229487-passing-varriables/#findComment-1182354 Share on other sites More sharing options...
PFMaBiSmAd Posted March 3, 2011 Share Posted March 3, 2011 Because LINK is an invalid method, the form defaults to GET method, i.e. the data is submitted in the URL/LINK. Quote Link to comment https://forums.phpfreaks.com/topic/229487-passing-varriables/#findComment-1182356 Share on other sites More sharing options...
cyberRobot Posted March 3, 2011 Share Posted March 3, 2011 Because LINK is an invalid method, the form defaults to GET method, i.e. the data is submitted in the URL/LINK. Ah, thanks for clarifying! Quote Link to comment https://forums.phpfreaks.com/topic/229487-passing-varriables/#findComment-1182359 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.