Jump to content

PHP MySQL Blackberry..Can we all get along?


slickboyj

Recommended Posts

Is it possible and if so any suggestions would be appreciated.

 

I've created a page the pulls data from a mysql DB using the PHP mail() function. The data being displayed in the page can be emailed with a form on the same page. The form works when sending to a PC but the problem is that when the MySQL / PHP data is sent to a blackberry this comes up in the 'message' looking like this.

 

lãK Ñ%öÛ­ºÛ¬tÌ,ƒbÖ›•ì"vØïM¢·¬ziµ×(–ÊZœ Ê¢jþ×mu¸¢Z+QEQ]Šö¥Š ®(µÉ²·×½v+Ú–('WŸµ+ZµïÝŠÿÝŠÿív×[Ê%¢°QØjXœ~®²rµÖàr‰h¬Qv+–(W·÷¿ûµÖr‰¬v–·¿þ®

 

My question is does blackberry's OS understand PHP?

 

I don't have access to the blackberrys. I need to do this on the html/server side.

 

thanks

Joe

 

 

Link to comment
https://forums.phpfreaks.com/topic/52639-php-mysql-blackberrycan-we-all-get-along/
Share on other sites

I don't know much about BlackBerry, but if you are sending e-mails via a php-script to the BlackBerry it doesn't make sense to ask if the BlackBerry's OS understands PHP. The BlackBerry (or any device with an e-mail client installed on it receiving your php generated e-mails) will not have anything to do with PHP - all the PHP code are interpreted on the server and the output is send in an e-mail message.

 

So I think you have a problem with some character encoding and character set. What language are your messages in and can I/we please see the script which generates and sends the e-mail?

The text sound like a lead. It does make sense why its bringing up the garbled message.

 

Here is part of the code I belive may have clues.

 

 


.style12 {font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
.style14 {font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 14px;
}

/............/

                                  $id = $_GET['id'];

	                           $sql = "SELECT * FROM employment_resume WHERE id='$id'";
     
	                           $result = mysql_query($sql) or die (mysql_error());

	                           $row = mysql_fetch_array($result);

	                           if (!is_array($row)) {
			             echo "Opps! Nothing to confirm. Please contact your administrator";
				     exit;
				  }


                                    $to=$_POST['emailaddress'];
			    $to .=$_POST['emailaddress2'];

                                    /* Get the form date from the variable $_POST which stores everything
                                    from the form since the method of the form is post if it was get
                                    you would use $_GET instead of $_POST. You can reference it directly e.g.
                                    $email but it may not work because the setting register_globals is off
                                    by default which means you have to use $_POST or $_GET to access form data
                                    */
                                   
			   //add From: header
                                   $headers = "From: Human Resources\r\n";

                                   //specify MIME version 1.0
                                   $headers .= "MIME-Version: 1.0\r\n";

                                   //unique boundary
                                   $boundary = uniqid("HTML");

                                   //tell e-mail client this e-mail contains//alternate versions
                                   $headers .= "Content-Type: multipart/alternative" .  
                                               "; boundary = $boundary\r\n\r\n";

                                   //message to people with clients who don't
                                   //understand MIME
                                   $headers .= "This is a MIME encoded message.\r\n\r\n";

                                   //plain text version of message
                                   $headers .= "--$boundary\r\n" .
                                               "Content-Type: text/plain; charset=ISO-8859-1\r\n" .
                                               "Content-Transfer-Encoding: base64\r\n\r\n";
                                   $headers .= chunk_split(base64_encode("This is the plain text version!"));
							   
                                   //HTML version of message
                                   $headers .= "--$boundary\r\n" .
                                               "Content-Type: text/html; charset=ISO-8859-1\r\n" .
                                               "Content-Transfer-Encoding: base64\r\n\r\n";
                                   $headers .= chunk_split(base64_encode(""));


                                   $from = 'Human Resourses';
							   
                                   $message = '<b>ONLINE RESUME</b><br><br><br>';
							   
			   $message .="<HTML><BODY>
			                        <table width='700' border='0' cellpadding='0' cellspacing='3' bgcolor='#FFFFFF'>
                                                          <tr>
                                                            <td colspan='5' bgcolor='#CCCCCC'><div align='left' class='style14'>Personal Information </div></td>
                                                          </tr>
                                                          <tr>
                                                            <td colspan='5' bgcolor='#FFFFFF'><input type='hidden' name='$id'></td>
                                                          </tr>
                                                          <tr>
                                                            <td bgcolor='#FFFFFF'> </td>
                                                            <td bgcolor='#FFFFFF' class='style12'> </td>
                                                            <td colspan='3' bgcolor='#FFFFFF'> </td>
                                                          </tr>
                                                          <tr>
                                                            <td bgcolor='#FFFFFF'> </td>
                                                            <td bgcolor='#FFFFFF' class='style12'><div align='left'>First Name:</div></td>
                                                            <td colspan='3' bgcolor='#FFFFFF'><div align='left' class='style16'>".$row['first_name']."</div></td>
                                                          </tr>
                                                          <tr>
                                                            <td bgcolor='#FFFFFF'> </td>
                                                            <td bgcolor='#FFFFFF' class='style12'><div align='right' class='style12'>
                                                              <div align='left'>Last Name: </div>
                                                            </div></td>
                                                            <td colspan='3' bgcolor='#FFFFFF'><div align='left'  class='style16'>".$row['last_name']."</div></td>
                                                          </tr>
                                                          <tr>
                                                            <td bgcolor='#FFFFFF'> </td>
                                                            <td bgcolor='#FFFFFF' class='style12'><div align='left'>Home Address: </div></td>
                                                            <td colspan='3' bgcolor='#FFFFFF'><div align='left' class='style16'>".$row['home_address']

                                                            ....................
                                                            </table>
/........./

                                    $subject=$_POST['subject'];
                                    $submit=$_POST['submit'];

                                    if(mail($to,$subject,$message,$headers)){
                                      echo "Resume was successfully Sent";
                                    }else{
                                      echo "Resume Sending Failed";
                                    }

 

I hope this helps.

Hay there,

 

Something that you could try that i would is take out all Input type and Text formating. Form what i have seen working with mobile devices they normally automatically format forms etc

 

Any mobile forms i create i always let the software on the phones do the formatting for me, because different devices read code differently.

 

Hope this helps!

perhpas try send just a plain text email - see if the browser on the BB can handle that...

 

also - this is a stab in the dark mind

 

your html in the message has single quoted values for all attributes AND does NOT start with html

 

swap your message text for this..

 

$message = '<html><body><b>ONLINE RESUME</b><br><br><br>';
							   
			   $message .='
			                        <table width="700" border="0" cellpadding="0" cellspacing="3" bgcolor="#FFFFFF">
                                                          <tr>
                                                            <td colspan="5" bgcolor="#CCCCCC"><div align="left" class="style14">Personal Information </div></td>
                                                          </tr>
                                                          <tr>
                                                            <td colspan="5" bgcolor="#FFFFFF"><input type="hidden" name="$id"></td>
                                                          </tr>
                                                          <tr>
                                                            <td bgcolor="#FFFFFF"> </td>
                                                            <td bgcolor="#FFFFFF" class="style12"> </td>
                                                            <td colspan="3" bgcolor="#FFFFFF"> </td>
                                                          </tr>
                                                          <tr>
                                                            <td bgcolor="#FFFFFF"> </td>
                                                            <td bgcolor="#FFFFFF" class="style12"><div align="left">First Name:</div></td>
                                                            <td colspan="3" bgcolor="#FFFFFF"><div align="left" class="style16">'.$row["first_name"].'</div></td>
                                                          </tr>
                                                          <tr>
                                                            <td bgcolor="#FFFFFF"> </td>
                                                            <td bgcolor="#FFFFFF" class="style12"><div align="right" class="style12">
                                                              <div align="left">Last Name: </div>
                                                            </div></td>
                                                            <td colspan="3" bgcolor="#FFFFFF"><div align="left"  class="style16">'.$row["last_name"].'</div></td>
                                                          </tr>
                                                          <tr>
                                                            <td bgcolor="#FFFFFF"> </td>
                                                            <td bgcolor="#FFFFFF" class="style12"><div align="left">Home Address: </div></td>
                                                            <td colspan="3" bgcolor="#FFFFFF"><div align="left" class="style16">'.$row["home_address"].'</div>

                                                            
                                                            </td>
													  </tr>
									</table></body></html>';

 

Now I know this shoud not matter but you never know...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.