jwk811 Posted May 7, 2011 Share Posted May 7, 2011 this is so frustrating. i know my coding isnt wrong. the most basic form doesnt even work (always). formp1.php <form method="post" action="formp2.php"> <input type="text" name="text" id="text"> <input type="submit"> </form> formp2.php <?php echo $_POST['text']; ?> heres the thing it works SOMETIMES. i send the form and it shows. i go back and do it again and it doesnt. another time it shows another time it doesnt. all the same text input to. i put the number 1. what could possibly do this? its not my browser i tried 2 different browsers. it makes no sense what so ever someone give me something PLEASE Quote Link to comment Share on other sites More sharing options...
jonsjava Posted May 7, 2011 Share Posted May 7, 2011 try this: formp2.php <?php if (isset($_POST){var_dump ($_POST);}else{echo "No POST data!";}?> Quote Link to comment Share on other sites More sharing options...
xyph Posted May 7, 2011 Share Posted May 7, 2011 Check out what's being populated in your raw post data $postdata = file_get_contents("php://input"); Quote Link to comment Share on other sites More sharing options...
jwk811 Posted May 7, 2011 Author Share Posted May 7, 2011 i tried what you said. it shows the array. it shows the array with the data SOMETIMES just like it did with the form. this is absouletly crazy. someone please try it out yourself. put data in the text field and submit it. it works. then go back refresh form do it again. tell me if it doesnt work sometimes. and also on page 2. resend data. once resent it usually doesnt show data. http://frozenasfs.com/form/formp1.php i even tried it on two different website servers. and this is all thats on each page exactly. formp1.php <form method="post" action="formp2.php"> <input type="text" name="text" id="text"> <input type="submit"> </form> formp2.php <?php if (isset($_POST)){ var_dump ($_POST); }else{ echo "No POST data!"; }?> Quote Link to comment Share on other sites More sharing options...
jonsjava Posted May 7, 2011 Share Posted May 7, 2011 Looks like a server issue. I see exactly what you are seeing. It will keep the data for a few refreshes (sometimes), then it drops the data, and will not see it on any subsequent refreshes. Gotta be a server issue at this point. PHP not the issue. Quote Link to comment Share on other sites More sharing options...
xyph Posted May 7, 2011 Share Posted May 7, 2011 If I click back, and resubmit the form, then it is blank. If I click back, refresh the page, then resubmit, it will always populate. It could be something in the server preventing accidental duplicate form submits Quote Link to comment Share on other sites More sharing options...
jwk811 Posted May 7, 2011 Author Share Posted May 7, 2011 ok at least i know im not crazy lol. i use godaddy. ill ask them about it but i doubt they will be able to do anything. maybe i should just change servers. any suggestions? Quote Link to comment Share on other sites More sharing options...
xyph Posted May 7, 2011 Share Posted May 7, 2011 Cheap, fairly reliable, fairly low traffic? I like dreamhost. Tons of features, with SSH access. I don't use them ATM, but have in the past, and no issues whatsosever. Quote Link to comment Share on other sites More sharing options...
jonsjava Posted May 7, 2011 Share Posted May 7, 2011 Hostmoster rocks, but u gotta have the year paid up front. Quote Link to comment Share on other sites More sharing options...
Drummin Posted May 7, 2011 Share Posted May 7, 2011 If you run server showing errors you'd get syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, for this part of the code $_POST['text'] I couldn't get this to fail. <?php echo "$_POST[text]"; ?> <form method="post" action="formp2.php" /> <input type="text" name="text" id="text" /> <input type="submit" value="Submit" /> </form> Quote Link to comment Share on other sites More sharing options...
efficacious Posted May 7, 2011 Share Posted May 7, 2011 what does it matter if after 5+ refreshes it drops the data? I'd leave the website if I had to submit more then once? j/w plus you could always keep track of the data with simple php scripts neway. Quote Link to comment Share on other sites More sharing options...
Drummin Posted May 7, 2011 Share Posted May 7, 2011 what does it matter if after 5+ refreshes it drops the data? I'd leave the website if I had to submit more then once? j/w The point is to write reliable code that doesn't fail. And yes, the <form tag> I posted above doesn't need to be escaped, just input tags. Quote Link to comment Share on other sites More sharing options...
efficacious Posted May 7, 2011 Share Posted May 7, 2011 what does it matter if after 5+ refreshes it drops the data? I'd leave the website if I had to submit more then once? j/w The point is to write reliable code that doesn't fail. And yes, the <form tag> I posted above doesn't need to be escaped, just input tags. What? Whats unreliable about it? In what situation would you NEED to resubmit the form 5+ times? Quote Link to comment Share on other sites More sharing options...
Drummin Posted May 7, 2011 Share Posted May 7, 2011 If it doesn't work all the time it's not reliable. And if you're making a comparison based on a $_POST['text'] comparing to "text" you may not get a match. Quote Link to comment Share on other sites More sharing options...
efficacious Posted May 7, 2011 Share Posted May 7, 2011 lol i'm going to go ahead and escape this line of convo as you make no sense and I don't want to fill the op's thread up trying to debate it with you. btw the only time the data is lost is after 5 times of resending the data(refreshing page after submission).. if you do exactly as the op instructed before.. Fill out the form> submit > see result > Click Back button > refresh page> repeat it>> .... works everytime. Quote Link to comment 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.