Jump to content


Staff Alumni
  • Posts

  • Joined

  • Last visited

Everything posted by kenrbnsn

  1. No, the nl2br function does not have to be used here. The OP wants to send a plain text email. As to your error message, you need a semi-colon at the end of the block, after the last " <?php $email_body = "You have received a new message from the user $name.\n Here is the message: \n $name \n $email \n $location \n $customer \n $text \n $future \n $website \n $features"; ?> As for payment, we help here for free. If you want paid help, post in the freelancing area. I recommend that you get familiar with the online PHP manual. It is actually very good with many user contributed examples. Also, there is W3 Schools. When we give you a manual page to look at, we are pointing you to the section in the online manual that describes the function. Make sure you read it. Ken
  2. You need a terminating semi-colon at the end of the statement and the mail function call is still wrong. BTW, in the future, when posting your code, please put it between tags. Ken
  3. First you didn't mention what error you were getting in your first post, so I didn't even look at your PHP code. When you get that error, it means that PHP got to the end of your file before a quoted string was finished or you have unmatched "{ }". In your case you never closed the string for the variable $email_body. But your code still isn't going to work, since the mail function call is wrong. The mail function takes at most 5 parameters: 1) An email address to send the mail to, i.e. the "To:" address 2) A Subject 3) the Body 4) The headers (optional, but should be supplied (IMHO)) 5) Additional headers that are send to the mail server (optional, but sometimes needed) Ken
  4. Learn how to write proper HTML. The start of the form needs to be after the <body> tag not before it: <body> <form method="post" name= "myemailform" action="form-to-email.php"> And there is no closing </form> tag. Not a PHP problem at all -- at least not now. Ken
  5. You should be using the function mysql_real_escape_string on all user inputs that are used in a MySQL query. <?php $sql = "INSERT INTO staff VALUES ( NULL, '$randeid', '" . mysql_real_escape_string($_POST['name']) ."', '" . mysql_real_escape_string($_POST['phone1']) ."', '" . mysql_real_escape_string($_POST['phone2']) ."', '" . mysql_real_escape_string($_POST['address']) ."', '" . mysql_real_escape_string($_POST['city']) ."', '" . mysql_real_escape_string($_POST['province']) ."', '" . mysql_real_escape_string($_POST['postal']) ."' )"; ?> Ken
  6. You're missing the closing ")" on this line: <?php while ($row = mysql_fetch_array($result, MYSQL_NUM){ ?> It should be <?php while ($row = mysql_fetch_array($result, MYSQL_NUM)){ ?> But that line won't work with the rest of your code, you should be using: <?php while ($row = mysql_fetch_assoc($result)){ ?> Ken
  7. The code you posted doesn't seem to relate to the question asked. There are some problems with this code: 1) You're storing the username in the file named password.txt and the password in the file named username.txt 2) There's nothing in your code to say which password goes with which password 3) You REALLY should be using a database for this. Ken
  8. Get yourself a mailing list program which are designed to do that efficiently. Ken
  9. You're returning an array from the function and you can not just echo an array. You can do <?php $contents = get_web_page($url); echo '<pre>' . print_r($contents,true) . '</pre>'; ?> to see what's in the array. Ken
  10. You're returning the $output at the end of your function, but you're not doing anything with it. Try: <?php $Url = "http://www.mysimplehtmlsite.ca"; function DownloadUrl($Url){ // create a new curl resource $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 1); // set URL to download curl_setopt($ch, CURLOPT_URL, $Url); // set referer: curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com/"); // user agent: curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); // remove header? 0 = yes, 1 = no curl_setopt($ch, CURLOPT_HEADER, 0); // should curl return or print the data? true = return, false = print curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // timeout in seconds curl_setopt($ch, CURLOPT_TIMEOUT, 50); // download the given URL, and return output $output = curl_exec($ch); // close the curl resource, and free system resources curl_close($ch); // print output return $output; } $page = DownloadUrl($Url); echo $page; ?> Ken
  11. In this line: <?php $sql = "insert into coords (playerID, coord) values ('$playerID', 'coord[$i]')"; ?> coord[$i] is a literal, since you forgot the "$" in front of it. <?php $sql = "insert into coords (playerID, coord) values ('$playerID', '$coord[$i]')"; ?> Ken
  12. You're reusing the variable $chunks inside the for loop. Use a different variable. Ken
  13. Are you saving your code as UTF-8? If so, make sure it's being save without the BOM characters. If the BOM is being saved, that will give you the message you're seeing. Ken
  14. No semi-colon on this line: <?php $check = mysql_num_rows($_get_other) ?> Ken
  15. That can be done with Javascript. I would use a library like jQuery Ken
  16. To get the list sorted, change the query to <?php $query="SELECT name FROM band_data2 ASC"; ?> "ASC" means sort in ascending order, to do a reverse sort use "DESC". Ken
  17. Since you aren't using the "id" field in your query, change your code for vote.php to <form action="insert.php" method="post"> <?php $con = mysql_connect("xxx","xxx","xxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("a3362005_bands", $con); $query="SELECT name FROM band_data2"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ $result = mysql_query ($query); echo 'Name:<select name="name">'; // printing the list box select command while($nt=mysql_fetch_array($result)){//Array or records stored in $nt echo "<option value=\"{$nt['name']}\">{$nt['name']}</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> <br /> skill : <select name="skill"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option></select> <input type="hidden" name="counter" value="1"> <input type="submit" /> </form></center> Also change the code for insert.php to <?php echo '<pre>' . print_r($_POST,true) . '</pre>'; $con = mysql_connect("xxx","xxx","xxx") or die("Could not connect<br>" . mysql_error()); mysql_select_db("a3362005_bands", $con); //Add to the table value with form data. $query = "UPDATE band_data2 SET skill = (skill + {$_POST['skill']}), skill_ave = (skill / counter) WHERE name='{$_POST['name']}'"; $rs = mysql_query($query) or die("Problem with the update query: $query<br>" . mysql_error()); echo 'vote counted'; ?> You only need one update query. Note: the reason you're new code is only getting one name is that the value is not enclosed in quotes. If you had looked at the generated HTML this would have been apparent. <?php echo "<option value=$nt[name]>name: $nt[name]}</option>"; ?> See my version above. Ken
  18. Ok. Please post you current code for both the form and insert.php What is happening now and why is it different from what you want? Have you looked at the generated source to make sure that the generated HTML is correct? Ken
  19. You're reusing the variable "$query" within a while loop that's using it. Use a different variable. Ken
  20. Why is most of your code commented out? Ken
  • 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.