Jump to content

PHP post varieable problem - please help


karenkane

Recommended Posts

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?

 

 

 

Link to comment
Share on other sites

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>


Link to comment
Share on other sites

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>

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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...  :(

Link to comment
Share on other sites

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.