webguync Posted December 28, 2010 Share Posted December 28, 2010 Hi, I have a weather app, coded which creates weather based on a set zip code. I want to create a form which when the user fills out their local code and clicks the send button that will change the zip code variable. Currently it is set up like this $zip = '90210'; //change to your zipcode need help with getting started with this. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/222850-help-with-changing-variable-via-form/ Share on other sites More sharing options...
Maq Posted December 28, 2010 Share Posted December 28, 2010 Sounds like you know what to do. Just assign $zip to the POST value after submission. Maybe I'm misunderstanding. Quote Link to comment https://forums.phpfreaks.com/topic/222850-help-with-changing-variable-via-form/#findComment-1152346 Share on other sites More sharing options...
webguync Posted December 28, 2010 Author Share Posted December 28, 2010 so it would just be this? <form method="post" action="<?php echo $PHP_SELF;?>"> Enter Zip Code:<input type="text" size="12" maxlength="12" name="zip"><br /> </form> and then I would change $zip='90210'; to $zip= $_POST["zip"] Quote Link to comment https://forums.phpfreaks.com/topic/222850-help-with-changing-variable-via-form/#findComment-1152351 Share on other sites More sharing options...
Maq Posted December 28, 2010 Share Posted December 28, 2010 Try it out. Quote Link to comment https://forums.phpfreaks.com/topic/222850-help-with-changing-variable-via-form/#findComment-1152352 Share on other sites More sharing options...
webguync Posted December 28, 2010 Author Share Posted December 28, 2010 appears to be working, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/222850-help-with-changing-variable-via-form/#findComment-1152354 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.