Jump to content

Mailing list


sudsy1970

Recommended Posts

hi all,

 

am trying to set up a mailing list but am have some problems with it all. 

 

 

1) have the following error

Fatal error: Call to undefined function doDB() in C:\xampp\htdocs\mail\manage.php  on line 27
yet i have defined that function in a file called include.php that the first item called.

 

2) i wish to place the file into a table, how can i place it into a table cell ?  have tried

include 'manage.php';

in the correct cell put that does not seem to work.

 

Any help greatly appreciated, code attached.

 

[attachment deleted by admin]

Link to comment
Share on other sites

ok thanks joe,  solved the first issue.

 

2) the file i have created is called manage.php.  if i wanted to have this code on a page i would use the include function in php, i think, which is normally at the start of the page. If i wanted include just this section

<form method=\"POST\" action=\"".$_SERVER["PHP_SELF"]."\">

<p><strong>Your E-Mail Address:</strong><br/>
<input type=\"text\" name=\"email\" size=\"40\" maxlength=\"150\">

<p><strong>Action:</strong><br/>
<input type=\"radio\" name=\"action\" value=\"sub\" checked> subscribe
<input type=\"radio\" name=\"action\" value=\"unsub\"> unsubscribe

<p><input type=\"submit\" name=\"submit\" value=\"Submit Form\"></p>
</form>";

 

in say a cell in a table how could i do that ?

 

is that clearer or not ?

Link to comment
Share on other sites

Get more errors that way. put that code into a file called mailform.php and then called it like so, my problem i think is i am not sure of the first line. think that i have included it correctly though

 

<?php
        
        <form method=\"POST\" action=\"".$_SERVER["PHP_SELF"]."\">

<p><strong>Your E-Mail Address:</strong><br/>
<input type=\"text\" name=\"email\" size=\"40\" maxlength=\"150\">

<p><strong>Action:</strong><br/>
<input type=\"radio\" name=\"action\" value=\"sub\" checked> subscribe
<input type=\"radio\" name=\"action\" value=\"unsub\"> unsubscribe

<p><input type=\"submit\" name=\"submit\" value=\"Submit Form\"></p>
</form>";

?>

 

Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\Cosford\mailform.php  on line 3

 

Link to comment
Share on other sites

Try putting an echo before your code:

<?php
        
echo "<form method=\"POST\" action=\"".$_SERVER["PHP_SELF"]."\">

<p><strong>Your E-Mail Address:</strong><br/>

<input type=\"text\" name=\"email\" size=\"40\" maxlength=\"150\">

<p><strong>Action:</strong><br/>

<input type=\"radio\" name=\"action\" value=\"sub\" checked> subscribe

<input type=\"radio\" name=\"action\" value=\"unsub\"> unsubscribe

<p><input type=\"submit\" name=\"submit\" value=\"Submit Form\"></p>

</form>";

?>

Link to comment
Share on other sites

Use this:

 

<form method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?> ">
<p><strong>Your E-Mail Address:</strong><br/>
<input type="text" name="email" size="40" maxlength="150" />
<p><strong>Action:</strong><br/>
<input type="radio" name="action" value="sub" checked="checked" /> subscribe
<input type="radio" name="action" value="unsub" /> unsubscribe
<p><input type="submit" name="submit" value="Submit Form" /></p>
</form>

Link to comment
Share on other sites

the echo seems to work as in i now have the form in the correct place however, i can add the same email as many times as i want and am unable to unsubscribe.

 

if i keep the code seperate then it all works so i am thinking that the somewhere i am not referencing back to the correct part of the script.  Because i now have the form in the correct place does this mean i need to remove it from manage.php, could this cause a conflict.

 

Tried your for Joephp and still get a parse error.

Link to comment
Share on other sites

ok thanks for your patience guys, i now have it kind of working.  once i have unsubscribed i have a message coming up telling me that i have done so see code below. How can i add a link to return me me to another address, such as index,php but still keep the code to tell me whats happening.  have tried the normal href but that does not work.

 

	//unsubscribe the address
		$del_sql = "DELETE FROM subscribers WHERE id = '".$id."'";
		$del_res = mysqli_query($mysqli, $del_sql) or die(mysqli_error($mysqli));
		$display_block = "<P>You're unsubscribed!</p>";
	}    
	mysqli_close($mysqli);
}
}

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.