Jump to content

Easy one... Sending information to another file automatically...


Recommended Posts

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

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();

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?

<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>

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.