What i am looking for is so I can input an url on my end http://www.someurl.com&sub= (can edit the php doc itself) I need to be able to change this url and use it on different sites. Then have an input box on the site (would prefer to call it with php include if possible) where user would input his or her email(X@hotmail.com). Then click a button that has "Get Link" on it This would reload the page the php include is called on and output a clickable link that opens in a new window http://www.someurl.com&sub=X@hotmail.com At the same time when the person click get link I would like an email sent to an email address i designate in the php doc with the following info (if possible): Url Created refferer IP Date/Time keyword Does that make sense and anyone know of where i can get a script like this?
So, you just want the user to put in their e-mail and then have an email sent to that email address? You don't need to append the email to the end of the URL then - you can simply post it like you would a normal form. Then, you can use $_POST to get the address in the PHP file that you post to and email it using PHP's mail function. If you want to append it to the URL though for some reason, you can do it using Javascript button. Just have the onclick for the submit button call a Javascript function that gets the value from the box and adds it to the URL and redirects the user to that URL. Then you have to use $_GET to obtain it in the PHP file to pull it from the URL.
No i want the user to input their email hit get link. the email entered will then get added to end of the link and be posted on the page. at the same time the information will be sent to my email. make sense?
Ok, well you just make your form: <input type="text" name="email"> <input type="button" name="myButton" value="Add E-Mail"> HTML: Then your Javascript: myButton.onPress = function() { getURL("myScript.php?email="+email); } HTML: Then your PHP script (myScript.php): <?php $email = $_GET['email']; $referrer = $_SERVER['HTTP_REFERER']; $ip = $REMOTE_ADDR; $message = $email . ", " . $referrer . ", " . $ip ."Whatever you want to say"; mail(youremail, subject, message); ?> Your email is: <?php echo $email; ?> PHP:
i don't want there email posted to the page, i want the link that has the email on the end of it posted to the page..... so they can follow the link Thanks for your help.
Then you just add: $link = "http://www.yoursite.com/page.php?email=" . $email; PHP: and echo it onto the page the same way the address was: echo "Here is your link: " . $link; PHP:
ok what am i missing? this is in the main page the action.php as all i get after you click get link button is Here is your link: http://www.yoursite.com/page.php?email= Without the actual email input on the end..... thanks again for your help.
You don't need the form part of that (nor the submit part of the button) since its not doing a post, it's just a Javascript that brings you to a PHP page and attaches the variable. The Javascript above should be in the header of your main page (HTML file) along with the text field and button. Then, you should re-name page.php to your PHP page (action.php) and that should work if you have the $_GET and everything.
how does the form show up on the page if it is all in the header? in action anythign else i need to do...
Just the Javascript part in the header like this: <html> <head> <script language="javascript"> myButton.onPress = function() {getURL("myScript.php?email="+email);} </script> </head> <body> <input type="text" name="email"> <input type="button" name="myButton" value="Get Link"> </body> </html> HTML:
I'd try and ask in the Javascript section - I'm mostly a PHP/MySQL guy - not sure why it's not working. Sorry.
This code should work except that you missed one thing.... you declare method=post in your form but in your action script you use $_GET Change it to $_POST and everything will work...so instead of $email = $_GET; It should look like $email = $_POST[email];