karenkane Posted December 5, 2008 Share Posted December 5, 2008 I need a bit of help with this. What I am attempting to do is create an unsubscribe page that takes an email address entered into a php form and emails that to me so that I can manually remove it from our list. the thing is that I want a custom submit button that just so happens to be a image. Here is the page (Unsubscribe.php) code for the form: <form method="post" action="unsub.php"> <div style="text-align: center;"> <span style="font-weight: bold;">Email Address </span> <input size="35" name="EmailAddress"> <br> </div> <a href="unsub.php"><img style="border: 0px solid ; width: 150px; height: 35px;" alt="" ;="" src="Images/bg_button.gif"></a> </form> And here is the mailer script (unsub.php) code: <?php error_reporting (E_ALL ^ E_NOTICE); include("Unsubscribe.php"); $from = $_POST['EmailAddress']; $to = "EmailAddressHere@server.com"; $subject = 'Email Blast Unsubscribe Request'; $headers = 'MIME-Version: 1.0\r\n'; $headers .= 'Content-type: text/html; charset=iso-8859-1\r\n'; $headers .= 'Content-Transfer-Encoding: base64\r\n'; $message = $from ." has requested not to recieve future Newsletters."; # Attempt to send email if(mail($to, $subject, $message, "From: $from", $headers)) echo "Your request to unsubscribe has been sent!"; else echo "Your request to unsubscribe has failed, please try again in a little while!"; ?> Here is my problem, I know I am doing someting wrong with the post, as in its not getting submitted, but I cant figure out how to fix this. Can someone please help? Quote Link to comment https://forums.phpfreaks.com/topic/135707-php-post-varieable-problem-please-help/ Share on other sites More sharing options...
gevans Posted December 5, 2008 Share Posted December 5, 2008 it's a html/javascript problem <form id="uns_form" method="post" action="unsub.php"> <div style="text-align: center;"> <span style="font-weight: bold;">Email Address </span> <input size="35" name="EmailAddress"> <br> </div> <a href="#" onclick="document.getElementById('uns_form').submit();"><img style="border: 0px solid ; width: 150px; height: 35px;" alt="" src="Images/bg_button.gif"></a> </form> Quote Link to comment https://forums.phpfreaks.com/topic/135707-php-post-varieable-problem-please-help/#findComment-707074 Share on other sites More sharing options...
Brian W Posted December 5, 2008 Share Posted December 5, 2008 plain links don't submit forms. buttons or JavaScript can. Quote Link to comment https://forums.phpfreaks.com/topic/135707-php-post-varieable-problem-please-help/#findComment-707076 Share on other sites More sharing options...
gevans Posted December 5, 2008 Share Posted December 5, 2008 Yea sorry, I should've given you more info, not just change your code. Brian W is right! Quote Link to comment https://forums.phpfreaks.com/topic/135707-php-post-varieable-problem-please-help/#findComment-707080 Share on other sites More sharing options...
Maq Posted December 5, 2008 Share Posted December 5, 2008 OR: Quote Link to comment https://forums.phpfreaks.com/topic/135707-php-post-varieable-problem-please-help/#findComment-707083 Share on other sites More sharing options...
Brian W Posted December 5, 2008 Share Posted December 5, 2008 I think this would also work... but am not 100% <form method="post" action="unsub.php"> <div style="text-align: center;"> <span style="font-weight: bold;">Email Address </span> <input size="35" name="EmailAddress"> <br> </div> <input type="submit" value="Submit" style="border:0px solid; width:150px; height:35px; background:url(Images/bg_button.gif);"/> </form> Quote Link to comment https://forums.phpfreaks.com/topic/135707-php-post-varieable-problem-please-help/#findComment-707095 Share on other sites More sharing options...
premiso Posted December 5, 2008 Share Posted December 5, 2008 I think this would also work... but am not 100% <form method="post" action="unsub.php"> <div style="text-align: center;"> <span style="font-weight: bold;">Email Address </span> <input size="35" name="EmailAddress"> <br> </div> <input type="submit" value="Submit" style="border:0px solid; width:150px; height:35px; background:url(Images/bg_button.gif);"/> </form> I think this would also work too: <form method="post" action="unsub.php" name="unsub" id="unsub"> <div style="text-align: center;"> <span style="font-weight: bold;">Email Address </span> <input size="35" name="EmailAddress"> <br> </div> <img src="Images/bg_button.gif" onClick="document.unsub.submit();" /> </form> Not to say either is better, but yea. With the onClick function anything is possible. The only downside is that this version you need to have javascript enabled vs Brian's you do not. Quote Link to comment https://forums.phpfreaks.com/topic/135707-php-post-varieable-problem-please-help/#findComment-707103 Share on other sites More sharing options...
Brian W Posted December 5, 2008 Share Posted December 5, 2008 with my version <input type="submit" value="Submit" style="border:0px solid; width:150px; height:35px; background:url(Images/bg_button.gif);"/> you could add some javascript to ask them to confirm which is nice and if they don't have javascript enabled, the button simply just works without confirmation. unnecessary but cute...lol going above and beyond! Quote Link to comment https://forums.phpfreaks.com/topic/135707-php-post-varieable-problem-please-help/#findComment-707110 Share on other sites More sharing options...
karenkane Posted December 5, 2008 Author Share Posted December 5, 2008 Oh my gosh, you guys are so wonderful thanks so much. I added this and it works now! :-) <input type="submit" value="Submit" style="border:0px solid; width:150px; height:35px; background:url(Images/bg_button.gif);"/> Quote Link to comment https://forums.phpfreaks.com/topic/135707-php-post-varieable-problem-please-help/#findComment-707176 Share on other sites More sharing options...
BloodyMind Posted December 5, 2008 Share Posted December 5, 2008 Why don't you guys click on solved at the bottom of the screen so you can give some space to the unsolved problems and inform ppl thanks Quote Link to comment https://forums.phpfreaks.com/topic/135707-php-post-varieable-problem-please-help/#findComment-707180 Share on other sites More sharing options...
Maq Posted December 5, 2008 Share Posted December 5, 2008 Why don't you guys click on solved at the bottom of the screen so you can give some space to the unsolved problems and inform ppl thanks I used to say the same thing, it's a hopeless cause... Quote Link to comment https://forums.phpfreaks.com/topic/135707-php-post-varieable-problem-please-help/#findComment-707207 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.