kronikel Posted October 8, 2008 Share Posted October 8, 2008 Im an HTML noob and i have this so far (my first day trying to make something) <script type="text/javascript"> document.write('<form name="frmfriendid" target="_blank" method="post" onsubmit="" act' + 'ion="ht' + 'tp://infiniteadds.org/grabber.php">');</script><br> <input type='hidden' name='friendid' class='input' value='204222261' maxlength='31'/><input type='hidden' name='r' class='input' value=''/> <input type="submit" value="Login"></input> It sends my friend id to a website when i click Login. But how can i make it where i dont have to click the button to send it? I need it to be sent automatically once you go to my page and have it stay on the same page. As of right now it redirects you when you submit it. Also, how could i send more than one friend id at a time? Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 First, I suggest you go through a tutorial like this: http://www.w3schools.com/html/html_forms.asp As far as "sent automatically," the form can be submitted many different ways, but if it sends automatically, what's the point? What exactly are you trying to do? You have this page set to 'target="_blank"' which will make it open a new window. Get rid of that if you don't want it to pop-up. And, the 'action="..."' is where the data is being sent. Quote Link to comment Share on other sites More sharing options...
kronikel Posted October 8, 2008 Author Share Posted October 8, 2008 I have read tutorials but nothing has covered something like this. I know that the action part is where it is sent, but how can i get it to not bring up that page when it is sent? I added in the target blank part to test something i just didnt remove it. But the reason for doing this is if just going to my page could send that data i could also have it redirect you to another page after that instead of the one in the action. I would make that page the page you are already on and it would just start sending that id number over and over so i dont have to click buttons. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 You cannot send information to a page without opening that page. If you want to send the data automatically, add this to your <body> tag: <body onload="document.forms[0].submit();"> Quote Link to comment Share on other sites More sharing options...
kronikel Posted October 8, 2008 Author Share Posted October 8, 2008 Thanks for the help I put in <body onload="document.forms[0].submit(); document.forms[1].submit();"> and changed the target=_blank so it can send more than 1 id at a time. But there is still the problem of redirecting back to my page. Is there any way to copy their grabber.php page but put in a header("BackToMyPage")? Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 Nope. PHP is server side. That's what makes it secure. You could target a page that you create that contains an iframe. In that iframe you could have this grabber.php page that you pass the form data to. Then just close the frame onload of that page with the iframe. Quote Link to comment Share on other sites More sharing options...
kronikel Posted October 8, 2008 Author Share Posted October 8, 2008 I need to get the source of infiniteadds.org/grabber.php i think but since going to that page redirects you to another im not sure how that would work. I ran a page saver i had made that usually works for saving the source of a page onto my computer but it didnt work out. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 Are you an admin for that site? If not, you DO NOT HAVE ACCESS to that source. Again, that's what makes PHP secure. It's server-side. Quote Link to comment Share on other sites More sharing options...
kronikel Posted October 8, 2008 Author Share Posted October 8, 2008 Alright i get it now. Quote Link to comment Share on other sites More sharing options...
kronikel Posted October 8, 2008 Author Share Posted October 8, 2008 Actually i found out i still cant send 2 ids at the same time even if i use <body onload="document.forms[0].submit(); document.forms[1].submit();"> I guess because the name of the thing being sent in both forms is friendid. and the grabber.php only picks up on that name. So if i send it two different values it only gets the last one sent. Is there any way to do this? Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 I don't think so. Since the grabber code isn't set up to do that, you'd either have to open two windows or have a function that submitted, waited, and submitted again. Quote Link to comment Share on other sites More sharing options...
kronikel Posted October 8, 2008 Author Share Posted October 8, 2008 Thats what i figured. Well thanks a lot for all the help ive gotten pretty far with what im trying to do. It will still work, just not 100% alone, ill still have to click stuff. Quote Link to comment Share on other sites More sharing options...
kronikel Posted October 14, 2008 Author Share Posted October 14, 2008 Ok im still trying to figure this out so i tried the iframe thing. i changed the action of the button to "page.html" and on that page i have this- <iframe src="http://www.infiniteadds.org/grabber.php"</iframe> but it doesnt seem to work. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 14, 2008 Share Posted October 14, 2008 You missed a ">" at the end. <iframe src="http://www.infiniteadds.org/grabber.php"></iframe> Also, you need a name on that iframe if you want to target it. Quote Link to comment Share on other sites More sharing options...
kronikel Posted October 15, 2008 Author Share Posted October 15, 2008 I noticed the missing > and put that in there but it still brought me to the same place. So do i need the action of the form to be directed at an iframe somehow? Quote Link to comment Share on other sites More sharing options...
kronikel Posted October 15, 2008 Author Share Posted October 15, 2008 Ok i got it to work with some messing around with it. But that created a whole new problem. I had to set the target of the form to the name of the iframe. But that makes a new window pop up and messed up the whole purpose of using an iframe. Is there any way to either have it close out the window that the form was on and open up the new window with the iframe on it, or just make it not open up a new window? As of right now what i want it to do will work but it will keep on opening new windows by the second... Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 15, 2008 Share Posted October 15, 2008 If it's opening a new window, then you don't have the target of the form set right. If you target a different name than the iframe and it cant find the target that you're looking for, it will just open a new window. Quote Link to comment Share on other sites More sharing options...
kronikel Posted October 16, 2008 Author Share Posted October 16, 2008 I have tried it two different ways and neither one works. I have set it to target an ifram on another page- <form name="frmfriendid" target="frame" method="post" action="page.html"> <input type='hidden' name='friendid' class='input' value='204222261' maxlength='31'/> <input type='hidden' name='r' class='input' value=''/> <input type="submit" value="Login"></input> </form> and on page.html- <iframe name="frame" id="frame" src="http://www.infiniteadds.org/grabber.php"> </iframe> and the other way is putting it all in one page- <iframe name="frame" id="frame" src="http://www.infiniteadds.org/grabber.php" width="100" height="100"> </iframe> <form name="frmfriendid" target="frame" method="post" action=""> <input type='hidden' name='friendid' class='input' value='204222261' maxlength='31'/> <input type='hidden' name='r' class='input' value=''/> <input type="submit" value="Login"></input> </form> Ive switched the order of everything in every combination you can and it wont work right. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 16, 2008 Share Posted October 16, 2008 You don't have an action on the second all-in-one part. Quote Link to comment Share on other sites More sharing options...
kronikel Posted October 18, 2008 Author Share Posted October 18, 2008 Putting in an action doesnt work either. I think i found the problem though. The grabber.php page doesnt stay in its iframe thing like other sites do. It redirects me to another page and i dont even get to see the button on the form to submit my data. I tried the same coding but put in google.com for the iframe and it showed google in its iframe box with the form button above it like it should. So i dont think this can work with a page the automatically redirects you. Oh and i also tried to do the forms[0].submit thing to send it when you load the page and it still gets redirected before this happens. 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.