DWaller10 Posted July 15, 2010 Share Posted July 15, 2010 Hello PHPFreaks, This is my first post and I was hoping that I could get some help with a problem I'm having with a form I've cobbled together. I was asked to build a form for a local music venue that does outdoor shows. The wanted a form with corresponding graphics so people could check their site and get the status of their events in case of inclement weather. The form consists of three radio buttons - Event On, Event Canceled, and a generic 'Check This Space' graphic for days when there are no scheduled events. Here's the code for the form: <form method="get" name="myform" action="../status/event-status.php"> <input name="br" type="radio" onClick="document.myform.formVar.value='<img src=images/event-on.jpg>'">Event Is On<br> <input name="br" type="radio" onClick="document.myform.formVar.value='<img src=images/event-off.jpg>'">Event Is Off<br> <input name="br" type="radio" onClick="document.myform.formVar.value='<img src=images/check-space.jpg>'">Check This Space<br><br> <input type="hidden" name="formVar" value=""> <input type="submit" value="Send form!"> </form> When the form is submitted, the output is sent to a second file that shows the appropriate graphic for show status. My intent was to display the page inside an iframe at the top of their calendar page. The problem I'm having is that when the form is submitted and redirects to the Event Status page, the graphic shows up fine. However, when I try putting the URL into the iframe (or if I simply try bringing up the page in a new browser tab), the form output won't display. I just get a blank page. Here's the code for the output page: <?php echo $_GET['formVar']; ?> My first impulse was to change the form action from Post to Get, so I did that. While the URL reflects the current status correctly, I can't really 'hard-wire' the URL because if the status is changed, the URL would not update to reflect the change. Extra info: The form is inside a password-protected directory, while the output page and corresponding graphics are in another directory inside the root directory. I only mention this in case the different directories could create a problem. I know I've got to be missing something somewhere, but my knowledge of PHP is rudimentary (to say the least) and I seem to be stuck. Is there any way to solve this? Any help would be appreciated, because the client saw the working form and is wondering why it's not live yet. Sorry for the wordy first post, BTW. Quote Link to comment https://forums.phpfreaks.com/topic/207857-first-post-form-output-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 15, 2010 Share Posted July 15, 2010 Web servers are stateless. They don't know or care anything about any http request that came before the current one or any that will come after the current one. Unless you store the status for each event somewhere on the server (in a database or a flat-file), it won't exist. You would then need to read the status and display it whenever anyone visits the page. The form you are submitted is only affecting the page it submits to. Any other visitor to that page won't see the results of the form YOU submitted when you do this. Quote Link to comment https://forums.phpfreaks.com/topic/207857-first-post-form-output-problem/#findComment-1086602 Share on other sites More sharing options...
DWaller10 Posted July 15, 2010 Author Share Posted July 15, 2010 Thank you for the reply. I had half an idea in my that I'd need to store the URL somewhere. Since this isn't technically 'my' site (I was just called in to create the form and don't have any sort of database access), I'm guessing a flat file is the way to go. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/207857-first-post-form-output-problem/#findComment-1086616 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.