Jump to content

kat32

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kat32's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. <?php session_start(); require 'common.php'; ob_start(); $member_logged_in=$_SESSION['member_logged_in']; if( isset($_POST['send']) && $_POST['sub'] ){ $fullname = $_POST['fullname']; $email = $_POST['email']; $subject = $_POST['sub']; $body=$_POST['body']; for ($i=0; $i<count($email); $i++) { if($_POST['email'][$i]!=""){ $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $sent=mail($email[$i], $subject[$i], $body[$i], $headers); if($sent) echo 'Message sent'; } } } ?> <form method="post"> <table> <tr><td>Full Name</td><td>Please Check</td><td>Subject</td></tr> <?php // $q = mysql_query("SELECT * FROM mailinglists") or die(mysql_error()); while($row = mysql_fetch_array($q)){ $fullname=$row['fullname']; $email=$row['email'];?> <tr> <td><?php echo $fullname; echo '<input type="hidden" value="'.$fullname.'" name="fullname[]" />';?></td> <td><input type="checkbox" name="email[]" value="<?php echo $email; ?>" /></td> <td><select name="sub[]"> <?php $q2 = mysql_query("SELECT * FROM composemails") or die(mysql_error()); while($row = mysql_fetch_array($q2)){ $subject=$row['subject']; echo '<option value="'.$subject.'">'.$subject.'</option>'; } ?> </select> </td> <?php $q3 = mysql_query("SELECT * FROM composemails") or die(mysql_error()); while($row = mysql_fetch_array($q3)){ $body=$row['body']; echo '<input type="hidden" value="'.$body.'" name="body[]" />'; } ?> </tr><?php } ?> <tr><td><input type="submit" value="Send Email" name="send"/></td></tr> </table> </form> I have inserted names and email addresses in the table mailinglists. I have inserted also the subject and body in the table composemails, so that users will need to select subject for every person in the mailing list. I check all the checkbox then send and it worked fine. The subject is blank when I send an email to the second or last name in the mailing list. When I open the email of the second or last person in the mailing list, "[No Subject]" appeared. I really need your help.
  2. kat32

    preg_replace

    thank you very much
  3. I like the logo of your website.
  4. how will I get values of checkbox if the previous and next are links(not buttons)?
  5. how will I post the checkbox values if the previous and next are links(not buttons)?
  6. When I click the submit button, I want to display the values of the checkbox that I checked in all pages. How do I modify this to work to remember what was checked on all pages.. Thanks <?php session_start(); include 'dbconnect.php'; $_SESSION['checked_uid'] = array(); if($_POST['submit']){ $checkedboxes = ''; foreach($_POST['cbox'] as $checkedid){ $checkedboxes .= $checkedid.','; } //$_SESSION['checked_uid'] = implode(rtrim($checkedboxes,',')); $_SESSION['checked_uid'] = substr($checkedboxes, 0, strlen( $checkedboxes ) - 1 ); } if(isset($_GET['p'])){ if($_GET['p']) $page = $_GET['p']; } else $page = 1; $q = mysql_query("SELECT * FROM tblusers"); $rows = mysql_num_rows($q); $posts_per_page=20; $pages = ceil($rows / $posts_per_page); $offset = $page * $posts_per_page - $posts_per_page;?> <form method="post" name="frm1" action="<? echo $_SERVER['PHP_SELF'];?>"><?php $query = mysql_query("SELECT * FROM tblusers LIMIT $posts_per_page OFFSET $offset") or die(mysql_error()); while($d = mysql_fetch_object($query)){ $uid=$d->uid; $username=$d->username; $checked = (in_array($uid,$_SESSION['checked_uid'])) ? 1 : 0; echo $username.' '; ?> <input type="checkbox" name="cbox[]" value="<?php echo $uid; ?>" <?php echo $checked ? 'checked' : '' ?> > <br /><?php } if($page > 1 ){ echo 'Pages:'; } if($page > 1) echo '<a href="?p=' . ($page - 1) . '"></a> '; else echo ''; for($a = 1; $a <= $pages; $a++) if($a == $page) echo "$a "; else echo '<a href="?p=' . $a . '">' . $a . '</a> '; if($page < $pages) echo '<a href="?p=' . ($page + 1) . '"></a>'; else echo ''; echo '</p>'; ?> <input type="submit" name="submit"></form>
  7. when I click the submit button, it will display the values of the checkbox that I checked in all pages. help please..
  8. please give code examples, thanks.
  9. I found this script on the net and used it to query the database and paginate results. Problem I have is that when navigating between pagination menu it does not 'remember' the checkboxes selected (e.g. tick checkbox on page 1 then navigate to page 2 then back to page 1, whatever was selected is not there, it has to be reselected). How do I modify this to work to remember what was selected on previous pages ... Thanks <html><head><title></title> <LINK href="style/style.css" rel=stylesheet type=text/css> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head><body bgcolor="#DDFFDD"> <?php $var1 = languages;//subject $var2 = debates;//category echo "<form name=\"form1\" method=\"post\" action=\"generate_rubric.php\">"; echo "<p class=\"font2\"><b>Criteria and Levels for:</b> </p>"; echo "<p class=\"font2\"><b>Subject:</b> " .$var1 ."<br>"; echo "<p class=\"font2\"><b>Category:</b> " .$var2 ."<p>"; include 'inc/db_subject.php'; // how many rows to show per page $rowsPerPage = 20; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $result = mysql_query("SELECT id, criteria, level1, level2, level3, level4, level5 FROM $var1 WHERE (category = '$var2') LIMIT $offset, $rowsPerPage") or die('Error, query failed'); // print the random numbers while($row = mysql_fetch_array($result)) { echo "<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" bgcolor=\"#DDFFDD\" class=\"tablemain\">"; echo "<tr><td valign=\"middle\" width=\"20\">"; echo "<input name=\"sendto[]\" type=\"checkbox\" id=\"sendto[]\" value=\""; echo $row['id']; echo "\" /></td>"; echo "<td valign=\"middle\" width=\"572\"><b>Criteria:</b> "; echo $row['criteria']; echo "</td></tr><tr><td colspan=\"2\">"; echo "<table width=\"600\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\" bgcolor=\"#DDFFDD\" class=\"tablemain\"><tr bgcolor=\"#FF9900\">"; echo "<td width=\"114\"><div align=\"center\">Level 1</div></td>"; echo "<td width=\"114\"><div align=\"center\">Level 2</div></td>"; echo "<td width=\"114\"><div align=\"center\">Level 3</div></td>"; echo "<td width=\"114\"><div align=\"center\">Level 4</div></td>"; echo "<td width=\"114\"><div align=\"center\">Level 5</div></td></tr><tr>"; echo "<td width=\"114\">" .$row['level1'] ."</td>"; echo "<td width=\"114\">" .$row['level2'] ."</td>"; echo "<td width=\"114\">" .$row['level3'] ."</td>"; echo "<td width=\"114\">" .$row['level4'] ."</td>"; echo "<td width=\"114\">" .$row['level5'] ."</td>"; echo "</tr></table></td></tr>"; echo "</table>"; echo "<p>"; } echo "<p><input type=\"submit\" value=\"Create Rubric\"> "; echo "<input type=\"reset\" name=\"Reset\" value=\"Reset\">"; echo "<p></form>"; // how many rows we have in database $query = "SELECT COUNT(id) AS numrows FROM $var1"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) { $nav .= " $page "; // no need to create a link to current page } else { $nav .= " <a href=\"$self?page=$page\">$page</a> "; } } // creating previous and next link // plus the link to go straight to // the first and last page if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">[Prev]</a> "; $first = " <a href=\"$self?page=1\">[First Page]</a> "; } else { $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\">[Next]</a> "; $last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } // print the navigation link echo "Test"; echo $first . $prev . $nav . $next . $last; ?> </body> </html>
  10. kat32

    preg_replace

    it says Fatal error: preg_replace(): Failed evaluating code:
  11. kat32

    preg_replace

    what's wrong with this <?php $msg2 = preg_replace("/\{(\w+)\}/e", "\$\\1", $msg); ?> please check, thanks in advance.
  12. I need to rewrite http://example.com/test.php?id=1 into http://example.com/test.html?id=1 or http://example.com/test1.html please help me, thanks in advance.
  13. still I can see the tags in my email
  14. <?php include('config.php'); $query = mysql_query("SELECT topics.topictitle, users.email FROM topics LEFT JOIN users ON topics.userid=users.userid WHERE topics.topicid=1") or die(mysql_error()); $row = mysql_fetch_array($query); $Name = "kat"; $sender_email = "kat32@yahoo.com"; $topictitle=$row['topictitle']; $email=$row['email']; $header = "From: ". $Name . " <" . $sender_email . ">\r\n"; $header =. "Content-type: text/html; charset=iso-8859-1\r\n"; $subject = "this is the subject"; $qry = mysql_query("SELECT emailmsg FROM emails WHERE emailmsgid=1") or die(mysql_error()); $row = mysql_fetch_array($qry); $body=$row['emailmsg']; $sent = mail($email, $subject, $body, $header); if($sent){ echo 'sent'; } ?> I have entered html tags <b>this is the body</b><br> <i>more text here</i>, etc. in the body using phpmyadmin. the problem is when I send it to my email, I can see the tags. it should be this is the body more text here Please help, thanks in advance.
×
×
  • 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.