Devboy Posted November 2, 2007 Share Posted November 2, 2007 Ok so tho code I have works good but.... Im just having issues sendind some data from one file to another automatically without the users input so far I have: echo "<form method='post' action='contest.php'> <input type='hidden' name='previously_entered' value='already_entered'/> </form>"; } and on the contest.php I have: $previously_entered = $_POST["previously_entered"]; if ($previously_entered == already_entered) { echo "<td class='mediumText' valign='center'><font color='red'>Sorry, but you have already entered!!</font></td>"; } else { echo "<td>", tep_draw_separator('pixel_trans.gif', '100%', '10'); "</td>"; } But with the code I have that's action is contest.php, it doesn't automatically goto contest.php. Now, I haven't done any php or html in a while so call me a "Newbie" but I can't for the life of me remember howto setup forms to automaticly forward that data on... if you get what I mean.. Thanks Tony Quote Link to comment https://forums.phpfreaks.com/topic/75710-easy-one-sending-information-to-another-file-automatically/ Share on other sites More sharing options...
kratsg Posted November 2, 2007 Share Posted November 2, 2007 You can make a form auto-submit using javascript: <script type='text/javascript'> function submit_form(name){ document.all.form.submit(); } </script> The basic idea is: document.all.[FORMNAME].submit(); Or, if you have form id="blah blah" document.getElementById("FORMID").submit(); Quote Link to comment https://forums.phpfreaks.com/topic/75710-easy-one-sending-information-to-another-file-automatically/#findComment-383151 Share on other sites More sharing options...
Devboy Posted November 2, 2007 Author Share Posted November 2, 2007 okie, I just tried: echo "<form action='contest.php' method='post' id='contest_registered'> <input type='hidden' name='already_entered' value='previously_entered' /> </form> <script language='JavaScript' type='text/javascript'> document.getElementById('contest_registered').submit(); </script>"; But the form isn't submiting still because it isn't forwarding me to contest.php.......... have I done something really stupid here? Quote Link to comment https://forums.phpfreaks.com/topic/75710-easy-one-sending-information-to-another-file-automatically/#findComment-383176 Share on other sites More sharing options...
Devboy Posted November 2, 2007 Author Share Posted November 2, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/75710-easy-one-sending-information-to-another-file-automatically/#findComment-383377 Share on other sites More sharing options...
aschk Posted November 2, 2007 Share Posted November 2, 2007 <form action="contest.php" method="post" id="contest_registered" target="hidden" name="content_registered"> <input type="hidden" name="already_entered" value="previously_entered" /> </form> <script>document.content_registered.submit();</script> Quote Link to comment https://forums.phpfreaks.com/topic/75710-easy-one-sending-information-to-another-file-automatically/#findComment-383380 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.