Jump to content

tyooseph

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tyooseph's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. response to micmania1 - www.php.net states the FROM is required or failure occurs. Note: When sending mail, the mail must contain a From header. This can be set with the additional_headers parameter, or a default can be set in php.ini. Failing to do this will result in an error message similar to Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing. The From header sets also Return-Path under Windows.
  2. The mail() result returns true (or 1) regardless of if the email is sent or 'accepted for deliver' (per php.net). According to php.net, mail() should not work without a proper header. However, if I comment out the $header line in my code below, mail() still returns true. I checked php.ini and sendmail_from is not set. (In case it matters, I'm running on localhost.) The code works, but I need to know when it fails. Reason I'm checking mail() is to inform the $requester that their request has been sent; otherwise, to display message for them to call. Here's what I've got... $to = staffone@arb.ca.gov, stafftwo@arb.ca.gov, staffthree@arb.ca.gov'; $subject = "Request Received From: $requester"; $headers = "From: test@xxx.arb.ca.gov\r\nCc: me@arb.ca.gov"; $message = "A request has been received from the subject property.\n\n To review information, please click on the following link:\n http://www.test.com/review.php?x={$_GET['id']}\n"; $message = wordwrap($message, 70); $message = str_replace ("/n.", "/n..", $message); $mail_sent = mail($to, $subject, $message, $headers); echo "<p>Msg Sent: $mail_sent</p>";
  3. Hello, I have a <select> statement which calls a javascipt function, updCities(), upon 'onchange'. My HTML page is generated using php and the javascript is contained within <script> tags at the end of my php script. The function takes the selected value from the <select> statement and populates the <options> of other <select> statements on the same page. The function works fine as long as the javascript script is placed with <script> tags at the end of my php script. But, if I place the javascript script in an external file (.js) I get an 'object expected' error at the line containing the 'onchange' call function. I am not familiar with javascript. I did not generate the code below and need help understanding how to call an external function. How can I call an external javascript function? Does the name of the external file have to be the name of the function? How can I pass the value from the select statement to the external function? Does the <script> tags have to be within the <head> tags?? Thanks, and here's my script... //php document generating the HTML page ... <select name="county" id="county" size=1 onchange="updCities(); "> ... <script language="JavaScript" type="text/javascript" scr="www.arb.ca.gov/msprog/bus/rptg/js/droplists.js"></script> // droplists.js JavaScript Document var url = "getcities.php?county="; // passes value to php script that populates other select options ... function updCities() { if (!isWorking && http) { var county = document.getElementById('county').value; http.open("GET", url + escape(county), true); http.onreadystatechange = handleHttpResponse; isWorking = true; http.send(null); } }
  4. Hello, I have a <select> statement which calls a javascipt function, updCities(), upon 'onchange'. My HTML page is generated using php and the javascript is contained within <script> tags at the end of my php script. The function takes the selected value from the <select> statement and populates the <options> of other <select> statements on the same page. The function works fine as long as the javascript script is placed with <script> tags at the end of my php script. But, if I place the javascript script in an external file (.js) I get an 'object expected' error at the line containing the 'onchange' call function. I am not familiar with javascript. I did not generate the code below and need help understanding how to call an external function. How can I call an external javascript function? Does the name of the external file have to be the name of the function? How can I pass the value from the select statement to the external function? Does the <script> tags have to be within the <head> tags?? Thanks, and here's my script... //php document generating the HTML page ... <select name="county" id="county" size=1 onchange="updCities(); "> ... <script language="JavaScript" type="text/javascript" scr="www.arb.ca.gov/msprog/bus/rptg/js/droplists.js"></script> // droplists.js JavaScript Document var url = "getcities.php?county="; // passes value to php script that populates other select options ... function updCities() { if (!isWorking && http) { var county = document.getElementById('county').value; http.open("GET", url + escape(county), true); http.onreadystatechange = handleHttpResponse; isWorking = true; http.send(null); } }
  5. Hello, I have a form with several fields that are required if the user checks a checkbox. I am validating the form and displaying errors on the screen for the user to correct; however, the checkbox does not remain checked if errors are displayed. I've tried searching the Internet for solutions and found the following, which does not work. Am I missing something? Please advise. Thank you. <input type="checkbox" name="showSummary"<?php if($showSummary == 'on'){echo " CHECKED";}?>> Summary
  6. Also, Vampen, the database is set to default to NULL value, but it doesn't work when data goes into database using php INSERT statement.
  7. Removing the single quotes from serial in $qry results in a blank field in the database.  I'm sorry for harping on this, but I've been struggling with this for weeks; really need help effigy.  Please advise.
  8. When I use $value = ' " ' . $value . ' " '; from your example, the database stored a set of double quotes ("") and not a NULL value.  When I remove the quotes from around the variable in the $qry statement, the script generates an error (blank screen).  I modified my code based on your example.  Did I miss something? $defaults['serial']=mysql_escape_string($_POST['serial']); if ($defaults['serial'] != 'NULL'){$defaults['serial']= ' " ' . $defaults['serial'] . ' " ' ;} $qry = "INSERT INTO vehicle (`agencyID`, `serial`) VALUES (' " . $_SESSION['id'] . " ', ' " . $defaults['serial'] . " ') " ;
  9. That's great! When I hard code the NULL value using single quotes it transfers to the database as it should. Now how do I incorporate this into my actual script.  I'm sure the problem is with the single and double quotes and the quote within quotes, but I haven't been able to find a good 'how to' on this subject.  When I try to remove the single quotes from the VALUES portion, the script encounters an error. Any ideas?  if (empty($_POST['serial'])){$defaults['serial']='NULL';}else{$defaults['serial']=$_POST['serial'];} $qry = "INSERT INTO vehicle (`agencyID`, `serial`) VALUES (' " . $_SESSION['id'] . " ', ' " . $defaults['serial'] . " ') " ;
  10. Ok. I've tried to simplify my code by hardcoding the variable values.   $serial=NULL;   $id=112;     $qry = "INSERT INTO vehicle (`agencyID`, `serial`) VALUES ($id, $serial)";   $result = mysql_query ($qry) or trigger_error("Query: $qry\n<br />MySQL Error: " . mysql_error()); This results in no data entry at all. If I change the value for $serial to a number, say $serial=59, then it inserts the record and places 59 in the field for serial and NULL for all my other fields that default to NULL. What am I doing wrong??
  11. I've tried that - even when I set the value to NULL, it stores a blank in the database.
  12. I'm currently developing a php form to interface with mySQL database.  Some form fields are not required and I would like to store NULL values in the database when no data is entered.  So, in the database, I set the fields' default values to NULL and it works when I insert a record using phpMyAdmin.  However, when I use my php script to insert the record using the INSERT statement, the field value enters as a blank instead of NULL.  Therefore, my searches for IS NULL produces no results. I'm using a variable array to hold the form value - $defaults['name']=$_POST['name'] - then use the variable array in the VALUE portion of the INSERT statement.  I have found a difference in how php handles the INSERT statement.  (Assume no entry from user) if I use the variable in the VALUE portion of the INSERT statement the record is inserted with blanks, not NULL; However, if I omit the variable array from the VALUE portion altogether, the insert statement inserts the record and the default value, NULL, is entered into the field. I don't want to create a complex script to determine if the fields are blank in order to omit those variables from the insert statement.  Is there a way to get the database to store NULL when no data is entered in the form field? PS - I use echo within php to display the form and have tried single quotes, double quotes, and no quotes and nothing works.  I really need help with this.  Thanks.
×
×
  • 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.