Jump to content

Shamrox

Members
  • Posts

    92
  • Joined

  • Last visited

    Never

Everything posted by Shamrox

  1. Can anyone tell me what is wrong here? First it failed to send the email, now it fails to load anything on the page. This is driving me nuts. <?PHP if(@$_REQUEST['step'] != "two") { ob_start(); include("invoice.php"); $to = $invoice['billemail']; //change this ob_end_clean(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Send <?PHP echo $_REQUEST['form']; ?></title> </head> <body> <form action="<?PHP echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="hidden" name="invoicenumber" value="<?PHP echo $_REQUEST['invoicenumber']; ?>"> <input type="hidden" name="form" value="<?PHP echo $_REQUEST['form']; ?>"> <input type="hidden" name="step" value="two"> <p> Send <?PHP echo $_REQUEST['form']; ?> to: <input type="text" name="send_to" value="<?PHP echo $to; ?>" size="50"> (Example: email@yourdomain.com, email2@yourdomain.com)<br> <input type="submit" name="submit_button" value="Send <?PHP echo $_REQUEST['form']; ?>"> </p> </form> </body> </html> <?PHP exit(); } elseif(@$_REQUEST['step'] == "two") { ob_start(); include("invoice.php"); $message = ob_get_contents(); //ob_end_clean(); $success = "Invoice sent successfully."; $failure = "Failed to send invoice email!!"; $from = $invoice['stb_email']; $subject = "Invoice - " . $invoice['invoicenumber'] . " - " . $invoice['studentlast'] . " - " . $invoice['coursecode'] . " - " . $invoice['coursename'] . ""; else { $send_to = $_POST['send_to']; $message = str_replace("../invoice.css", "http://www.domain.com/invoice.css", $message); $message = preg_replace("/\.?\.?\/images\/logo_hi-res_sm.gif/", "http://www.domain.com/images/logo_hi-res_sm.gif", $message); $message = str_replace("/images/gray_dot.gif", "http://www.domain.com/images/gray_dot.gif", $message); $message = str_replace("/images/shared_dot_clear.gif", "http://www.domain.com/images/shared_dot_clear.gif", $message); $sep = "\n"; $boundary = md5(uniqid("",true)); $b1 = "b1---$boundary"; $headers = "From: $from$sep"; //$headers .= "To: $send_to$sep"; $headers .= "Return-Path: $from$sep"; $headers .= "MIME-Version: 1.0$sep"; $headers .= "Content-Type: multipart/alternative; boundary=\"$b1\"$sep"; $headers .= "$sep"; //now set up the message $messageHeader = "--$b1$sep"; //default message $defaultmessage = "Your email client cannot read html email"; $messageHeader .= $defaultmessage.$sep; $messageHeader .= "$sep"; //html message $messageHeader .= "--$b1$sep"; $messageHeader .= 'Content-Type: text/html; charset="iso-8859-1"'.$sep; $messageHeader .= "Content-Transfer-Encoding: 8bit$sep"; $messageHeader .= "$sep"; $messageHeader .= $message; $messageHeader .= "$sep"; $messageHeader .= "--$b1--"; $messageHeader .= "$sep"; echo "<pre>$headers \r\n $messageHeader</pre>"; $results = @mail($send_to, $subject, $messageHeader, $headers); } if($results) { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Message Sent</title> </head> <body> <p><a href="dashboard-new.php">Dashboard</a> | <a href="registrar_new.php?registrarid=<?PHP echo $_REQUEST['registrarid']; ?>">Registrar</a></p> <p><?PHP echo $success; ?></p> <p>Message sent to: <?PHP echo $send_to; ?></p> <p>The following message was sent:</p> <hr> <?PHP echo $message; ?> </body> </html> <?PHP } else { echo $failure; } exit(); } ?>
  2. Thanks emehrkay, that was a ton of help!
  3. Could you provide a bit of code example as I have no clue how to write js.
  4. I have a dropdown list on a form that lists different types of credit cards. I also have a form field that is called charge card fee and I would like this to be populated with a $ amount based on what card was selected from the dropdown. Each card has a different fee that is a % of the sale price. So there is a third field of Price that is involved. Is there a way to have the fee field calculated and populated using javascript? Any help is appreciated. Thanks.
  5. I am sure this is pretty basic but i can't find anywhere the syntax for this. I have two tables, I want to know all the records that are in Table A, but not in Table B. Basically, if it finds a matching ID it wouldn't include that in the output. Help?
  6. Thank you much. I totally understand what to do now.
  7. This -> operator is giving me trouble b/c I'm not sure really how to use it. I have this simple alpha list script (see below) and I'd like to add a link to the echo'd Company name as well as listing the location. All of these would be fields of data pulled in the query but i'm not sure how to add them to the echo since it's using -> and also a . after Company_Name So, can anyone tell me the proper syntax for adding these additional items to the echo statement? FTR, i did try a few different ideas with no luck prior to posting this. Thanks. <?php mysql_select_db($database_spectrum, $spectrum); $sql = 'SELECT * FROM spec_vendorinfo ORDER BY Company_Name'; $result = mysql_query($sql) or die('ERROR: '.$query.' '.mysql_error()); $letterlinks = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; echo '<a name="top"></a>'; echo '<a href="#number">0-9</a> '; for ($i = 0; $i < 37; $i++): echo '<a href="#'.$letterlinks[$i].'">'.$letterlinks[$i].'</a> '; endfor; while ($list = mysql_fetch_object($result)): $letter = strtoupper(substr($list->Company_Name, 0, 1)); $location = $list->Location; $id = $list->vid; if ($prev_row != '0-9' && is_numeric($letter)): echo '<br /><a name="number"></a><b><u>0-9</u></b> '; echo '<a href="#top"><i>goto top</i></a><br />'; $prev_row = '0-9'; endif; if ($letter != $prev_row && !is_numeric($letter)): echo '<br /><a name="'.$letter.'"></a><b><u>'.$letter.'</u></b> '; echo '<a href="#top"><i>goto top</i></a><br />'; $prev_row = $letter; endif; echo $list->Company_Name.'<br />'; endwhile; ?>
  8. I'm trying to dumb down a emailing script i have using php on my clients site. Right now, it pulls an include page that has a table laying out a form for registration in a class. It pulls all the data from the database, populates it, includes it in the email body and sends. I now need to send a plain text only version of the data, obviously with no layout. Not sure how to include the page. I removed all the html tags from the include, but now i'm just left with text and the query data. Page won't work that way, Any help?
  9. Here's a bit more info after doing some major digging today. In the error logs I found this error. PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 54862 bytes) in /path/to/clients/files/registrar_new.php on line 788 I'm not sure what that means, so I went to look at what the code in line 788 was.. $sql = "SELECT * FROM `spec_supplier` ORDER BY `name`;"; $results = mysql_query($sql); while($row = mysql_fetch_array($results, MYSQL_ASSOC)){ $suppliers[] = $row; } Line 788 is the while statement. So, might someone have any other insite into my problem with the added info above? Thanks.
  10. Also to  note, things worked fine yesterday. What's a control path?
  11. www.sitename.com/registration.php?id=201    This loads fine. www.sitename.com/registration.php?id=202    This loads blank page.  Same exact code just pulling a different record from db. Still php dying??
  12. How so? Same page loads one record, but not another. How do I debug? Any suggestions?
  13. Oh, forgot to add that I'm using php/mysql.
  14. I have a page that lists recent registration entries. Click one of the names on the list and it takes you to the full detail of the record. Some load fine, some load a blank page. when I view the source all I see is... [code] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD> <BODY></BODY></HTML> [/code] Any idea what might be causing this? I've looked at the records in the db, but nothing seems wrong. HELP!!!!
  15. is there any way to do it with a php function and not go to another page?  What I'd like to see is the user clicks on the Clear icon and it removes the record from that table of data on the screen. Best/easiest method to do this?
  16. I'm trying to update the status of a record in my database using onClick to call a function I wrote, but it doesn't seem to do anything. What am I doing wrong here? Code for function: [code] function clear_record($id) { $sql = "UPDATE`spec_registrar` SET `surveystatus`= 'clear' WHERE `registrarid` = '$id';"; } [/code] Code for calling it: [code] <input type="image" img src="images/admin_images/gridicon_delete.gif" alt="Clear from table" width="20" height="20" border="0"  onClick="clear_record(<?php echo $row_rs_survey['registrarid']; ?>);"/> [/code]
  17. Alright, I've got this drop down working where it pulls all the files in. Is there a way to sort them alphabetically? Here's the code. Thanks for the assist. [code] ><select name='filename' id='filename'> <?php if ($handle = opendir('/path/to/the/options_sheets')) {   /* This is the correct way to loop over the directory. */   while (false !== ($file = readdir($handle))) {   if ($file != "." && $file != "..") {       echo "<option value='$file\n'>$file\n</option>";   }   }   closedir($handle); } ?> </select> [/code]
  18. Probably a simple mistake and I couldn't find an answer doing a search here, so another post on why the first record is dropped. Any one see what's wrong with my code? Works, but the first record never shows. [code] mysql_select_db($database_spectrum, $spectrum); $query_rs_rep = "SELECT stbrepid, stb_lastname FROM spec_stbrep ORDER BY stb_lastname ASC LIMIT 0, 30 "; $rs_rep = mysql_query($query_rs_rep, $spectrum) or die(mysql_error()); $row_rs_rep = mysql_fetch_assoc($rs_rep); $totalRows_rs_rep = mysql_num_rows($rs_rep); $repList = ''; while ( $row_rs_rep = mysql_fetch_array($rs_rep) ) {   $repList = $repList.'<li><a href="\dashboard.php?rep='.$row_rs_rep['stbrepid'].'&page=registrar">'.$row_rs_rep['stb_lastname'].'</a></li>'; } [/code]
  19. YES, you rule!!!! Gold star for wildteen88. thanks.
  20. Ok, I just can't get it. Maybe having an early morning brain freeze. what's missing here? My output is empty values. [code] $strQuery = "SELECT vendorname, sum(cogs) as sumcogs FROM spec_registrar WHERE orderdate>='2006-01-01' GROUP BY vendorname HAVING sumcogs>=15000";    $result = mysql_query($strQuery) or die(mysql_error());    $row = mysql_fetch_array($result);    $rowcount = mysql_num_rows($result);     while ($ors = mysql_fetch_row($result)) {     $strXML .= "<set label='" . $ors['vendorname'] . "' value='" . $ors['sumcogs'] . "' />";       } mysql_free_result($result); [/code]
  21. Query isn't empty and I thought I had put all the correct error values. anymore thoughts on this?
  22. Ok, this seems like it would be straight forward, but I keep getting "Query is empty" output on my page after I submit the form. Could someone please tell me WTH I'm doing wrong here???  Below is the entire page that is used as an include in the main page template. [code] <?php require_once('../Connections/spectrum.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);   switch ($theType) {     case "text":       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";       break;        case "long":     case "int":       $theValue = ($theValue != "") ? intval($theValue) : "NULL";       break;     case "double":       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";       break;     case "date":       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";       break;     case "defined":       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;       break;   }   return $theValue; } } mysql_select_db($database_spectrum, $spectrum); $query_rs_client = "SELECT clientid, name FROM spec_client ORDER BY name ASC"; $rs_client = mysql_query($query_rs_client, $spectrum) or die(mysql_error()); $row_rs_client = mysql_fetch_assoc($rs_client); $totalRows_rs_client = mysql_num_rows($rs_client); if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $colname_rs_output = "-1"; if (isset($_GET['clientid'])) {   $colname_rs_output = (get_magic_quotes_gpc()) ? $_GET['clientid'] : addslashes($_GET['clientid']); } $colname_rs_output = "-1"; if (isset($_GET['orderdateA'])) {   $colname_rs_output = (get_magic_quotes_gpc()) ? $_GET['orderdateA'] : addslashes($_GET['orderdateA']); } $colname_rs_output = "-1"; if (isset($_GET['orderdateB'])) {   $colname_rs_output = (get_magic_quotes_gpc()) ? $_GET['orderdateB'] : addslashes($_GET['orderdateB']); } mysql_select_db($database_spectrum, $spectrum); $query_rs_output = sprintf("SELECT `spec_course`.`ctitle`, `spec_course`.`course_num`, `spec_client`.`name`, `spec_contacts`.`lastname`, `spec_contacts`.`firstname`, DATE_FORMAT(`spec_registrar`.`orderdate`,'%c/%e/%Y') AS `orderdate1`, DATE_FORMAT(`spec_registrar`.`enddate`, '%c/%e/%Y') AS `enddate1`, DATE_FORMAT(`spec_registrar`.`startdate`, '%c/%e/%Y') AS `startdate1`, `spec_registrar`.* FROM `spec_registrar` INNER JOIN `spec_students` ON `spec_registrar`.`studentid` = `spec_students`.`studentid` INNER JOIN `spec_client` ON `spec_client`.`clientid` = `spec_students`.`clientid` INNER JOIN `spec_client` ON `spec_client`.`clientid` = `spec_registrar`.`clientid` INNER JOIN `spec_contacts` ON `spec_contacts`.`contactid` = `spec_students`.`contactid` WHERE `spec_registrar`.`clientid` = %s AND `spec_registrar`.`orderdate` BETWEEN %s AND %s", GetSQLValueString($colname_rs_output, "int"),GetSQLValueString($colname_rs_output, "date"),GetSQLValueString($colname_rs_output, "date")); $rs_output = mysql_query($query_rs_output, $spectrum) or die(mysql_error()); $row_rs_output = mysql_fetch_assoc($rs_output); $totalRows_rs_output = mysql_num_rows($rs_output); } ?> <form id="form1" name="form1" method="post" action="<?php echo $editFormAction; ?>">   <table width="100%" border="0" cellspacing="0" cellpadding="0">     <tr>       <td width="29%">Select Client:         <select name="select">           <?php do {  ?>           <option value="<?php echo $row_rs_client['clientid']?>"><?php echo $row_rs_client['name']?></option>           <?php } while ($row_rs_client = mysql_fetch_assoc($rs_client));   $rows = mysql_num_rows($rs_client);   if($rows > 0) {       mysql_data_seek($rs_client, 0);   $row_rs_client = mysql_fetch_assoc($rs_client);   } ?>         </select> </td>       <td width="16%"><input name="orderdateA" type="text" id="orderdateA" /></td>       <td width="55%"><input name="orderdateB" type="text" id="orderdateB" /><input type="hidden" name="MM_insert" value="form1"> <input type="submit" name="Submit" value="Submit" /></td>     </tr>   </table> </form> <!--Output the table starting here --> <table width="100%" border="0" cellspacing="0" cellpadding="0">   <tr>     <th scope="col">Order Date </th>     <th scope="col">Student Lastame, First </th>     <th scope="col">Course ID </th>     <th scope="col">Course Title </th>     <th scope="col">Training Co </th>     <th scope="col">Course Start date </th>     <th scope="col">Course End date </th>     <th scope="col">Course Length </th>     <th scope="col">Purchase Order </th>     <th scope="col">Cost Center </th>     <th scope="col">List Price </th>     <th scope="col">Sales Price </th>     <th scope="col">Status</th>   </tr>   <tr>     <td><? echo $row_rs_output['orderdate1']; ?></td>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>   </tr> </table> <?php mysql_free_result($rs_client); mysql_free_result($rs_output); ?> [\code][/code]
  23. I got it working after altering my code a bunch and then returning to almost what I started with, except for the fact that I used all caps for LAST_INSERT_ID(). Does the case matter for this function? Only thing I can think of that cause it not to work.
×
×
  • 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.