E-Mail Not Breaking Lines
I'm sending an e-mail via a contact form, but somehow the lines aren't breaking in the text, it always looks like this:
lorem ipsum
dolor
sit
amet
lorem
Which is of course not readable at all. What am I doing wrong here? I'm using a few security checks and such for cleaning the field up; $text = trim($text);
...
$text = stripslashes(strip_tags($text));
...
$text = mysql_real_escape_string($text);
.....
#and then the part where it's included in the message:
$message .= "Nachricht: {$text} ";
Can any of those be causing the display problem?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Multiple Message Lines In PHP Mail
I have a submission form for one of my sites, where artists can basically e-mail me all this information about their comic so I can look it over. Code:
Blank Lines Between Lines Of Text
how do i put a blank line between lines of text on my webpage using php eg within my while loop printf("<a href="%s?id=%s">%s %s %s %s </a><br> ",$PHP_SELF,$myrow["id"], $myrow["first"], $myrow["last"], $myrow["email"],$myrow["details"]); printf("");//this is what i thought might workdoes not work.
Breaking Strings?
I have a string (actually 100's of these, but lets take one): $string ="TI: Some journal title AU: SomeAuthor,-S; Smith,-A; Jones,-B SO: SomeSource. 2002 Jan 9; 287(2): 188; discussion 189-90 JN: Some Journal Title"; This needs to be turned into an array: $entry = array( 'Some Item Title', 'SomeAuthor,-S; Smith,-A; Jones,-B', 'SomeSource. 2002 Jan 9; 287(2): 188; discussion 189-90', 'Some Journal Title'); As you can see, each array item should be defined by what comes after either/all of the following: 'TI:' 'AU:' 'SO:' 'JN:' So, I need to be able to create a pattern that can look through the string and return everything in between TI: and AU:, then AU: and SO, etc. for example: eregi(???, $string, $entry); I'm fairly new to this and can't seem to figure out the regex I need for the pattern. Is this even the way to go about it?
Breaking Out Of An Iframe
I cannot figure this one out. My script is being displayed in an iframe (a wiki page) and I have one option won't give me the correct results unless the page is displayed in either a) new tab in NS browser b) new browser instance. The option in question is used to print forms, and I use the browser Print Preview for the page setup. It's all pretty useless if I have the page and iframe content in my preview. I thought using header() would do the trick.
Breaking A Page Down.
What is the best solution to break down a php page into certain section using MySql, For example i'm looking at designing a page that reffers to a MySQL database that contains the html code for the navigation. So that in future if the navigation changes I'll only need to changed the html code in the database and all the pages will be sorted. I'm also looking at doing the same for the information on the footer of the page, with teh contact details.
Breaking Out Of Quotes
I know I can use stuff like in front of " so that it can't break out of a "" and start doing bad things, but it seems there are other situations where, E.G., if the string is hex for " then it has the same effect, and stuff like that, and it gets tricky escaping it all, so I'm wandering, is there some kind of option I can enable or extension I can install that just simply prevents objects/variables/arrays from breaking out of single/double quotes and also for mysql queries? And also for html so E.G. echo"<img src='$asdf'>"; can't be exploited to do other things? I don't care if it isn't free as long as it works good and isn't to expensive..
Breaking Up Querys
I have a page that updates a table every workday. (these are standard updates, like if someone has moved, or has a different phone number or something.) It is too big of a query to run the entire table all at once, so it is split out. The split is grouped by the first letter of a first name field. Right now it is broken up into 5 parts, and each part has a group of letters (i.e. "a" to "d" is one group, "e" to "k" is the next, and so on. As you can see, these do not have an even number of letters, but that is because some letters have a lot more entries, and need to be in smaller groups.) The reason it is split out into 5 groups is that I can run one group on each workday (Monday through Friday), and I can have the PHP check what day of the week it is. (I use a case statement, the first case is for Monday, the second is for Tuesday, etc.) Code:
Breaking A Loop.
I have one going through rows of a sql database until it matches some data with user input. I need to put a break command in there but can't seem to find out how to achieve this.
Breaking Rows
I am using a while statement to pull results from my database. Now if I have like 40 results how would I make it break into rows. So instead of; result result result result result result result result result result result result result result result result result result I want; result result result result result result result result result result result result result result result result result result result result
XML Parser Breaking Up URLs
I'm having a problem parsing an xml file in which one of an elements character data is a url which contains multiple "&" characters. For some reason the parser breaks up the data into multiple pieces. For instance, when I call this function(abbreviated): function characterDataHandler ($parser, $data) { global $element; global $url; if ($element == "URL") { $url = $data; echo "url=".$url."<br>"; } } I get some output like this: url=http://www.somewebsite.com/index.jsp?s=af url=& url=filter=1 url=& url=show=all Do urls with querystrings have to be handled differently then regular character data?
For Loops Breaking At A Certain Multiple
Can someone help me out with writing a script that will make will loop 500 times, but at every 4th multiple, it will insert a peice of code? I tried all day to get this, and so far, nothing has worked.
Characters Breaking My Query
Im using encrypted data to store cc info. The PHP code encrypts and sends the result to the database. the problem is that the encrypted string contains lots of characters that will break my sql query. I can do a replace but there are lots of characters. for example, a character will look like this: g%$^'GDF$%^//"@#$%/||''$#"/|#dfsa. how can I put this information in a different format... and then retrieve the data to decrypt the string?
Not Breaking Loop In Function
I get this error: <b>Fatal error</b>: Cannot break/continue 1 levels in <b>file.php</b> on line <b>128</b><br> This happens when I call a function. In the function there is a break; This is cause the break is in a function and not in the loop. But it gets called inside the loop. Is there a fix for this?
Script Breaking On Mysql_result
I was trying to figure out why one of my scripts was failing and by using an "or die" statement for the SQL narrowed it down to this bit of code: $md5 = md5_file("swf/" . basename($jpg_link)); $dupe = mysql_result(mysql_query("select count(gId) from games where gSwfFile='$md5.swf"), 0); if(!empty($dupe)) { continue; } This is giving the following error - "Warning: mysql_result(): supplied argument is not a valid MySQL result resource" The thing is, I've checked that SQL query by running other values in place of $md5 through it and it appears to be fine. select count(gId) from games where gSwfFile='Flat War july 30th 2007.swf'; Any ideas?
Breaking Backwards Compatibility - Good Or Bad?
If you have any PHP scripts which will not work in the current releases due to breaks in backwards compatibility then take a look at http://www.tonymarston.net/php-mysq...everything.html and see if you agree with my opinion or not.
Breaking Survey Into Seperate Parts?
I have a very long survey form with 4 different sections. Is there anyway with php to split this form into 4 popup windows so the person can click on the section they wish to fill out and when they are done, go back to the host survey form and continue on? I know there must be a way to do it, i'm just at a loss as to how i would pass the variables off? Cookies perhaps?
Breaking Up A Comma Seperated List
i have a list seperated by commas: 1. 3. 5. 7. 9 actually is a varible $members ="1, 3, 5, 7, 9"; what would be the best way to break that up to insert the values into a table in a loop.
Breaking Up Text For Multiple Pages
I was recently put in charge of heading up my company's website, and while I have a lot of experience on the design side of things, I'm still very new to the programming side. When I started, the website had just gotten a revision, but the site was an utter mess, so I've been trying to fix it up. As I've gone along, I've learned some aspects of PHP, but my knowledge is still very limited. Here is the problem I'm trying to fix. A backend is used to enter information into our MySQL database, and then a page template pulls it out to make the page. For our reviews, the PHP coding currently breaks up the review's text so that it can be places across multiple pages. The problem is, the way the text breaking was set up, the end of one page and the beginning of the next are totally chaotic, with breaks often coming mid-sentence. Here is what I'd love: other coding automatically puts an HTML break at the end of paragraphs, and then another in the space between one paragraph and the next. I'd love to have the code search for when those double breaks come up, and then break up the text after, say, every sixth pair of HTML breaks. I'd also like the option to break the text myself by putting in some sort of text code in the original text. At this point, though, anything that can make the breaks more elegant would be a huge improvement. I really appreciate any help anybody can give me in this one. Please remember that I know very little of PHP, and I'm not much of a programmer anyhow, so things that you may take for granted that people would understand about PHP, I might not know. I tried to pull out what I thought was the current coding for the text break. Here it is. I'd also like to get rid of the part1/part2 factor. Before, they had the text breaking to help in fitting into the layout around an image, but I've fixed that so I no longer need the break. So, that portion no longer needs to be a factor. if ($page == ""){ $page = 1; } $no_letters = strlen($Game_Full_Story); $times = ($no_letters / 3800) +1; $Game_Full_Story = wordwrap($Game_Full_Story,3800,"*#^"); $Game_Full_Story = explode ("*#^", $Game_Full_Story); $pages = array(); for ($i=0; $i<$times ; $i++){ $part[$i] = $Game_Full_Story[$i]; if ($i != 0){ array_push($pages, $i); } } $page = $page-1; $story = $part[$page]; if (strlen($story) < 460){ $parts1 = $story; }else{ $story = wordwrap($story,460,"*#^"); $story = explode ("*#^", $story); $parts1 = $story[0]; $count = count($story); $parts2=""; for ($i=1; $i<$count; $i++){ $parts2 .=$story[$i]; $parts2 .=" "; } }
Breaking Up A String Into Individual Words
I have a text box that I will use to search a database. I would like to use it so that it will not use a whole string (ie. 'red striped top') but instead break it up into individual words (ie. 'red', 'striped', 'top') and maybe put it into and array. I will then use the words in the array to search the database. How do I break a string up this way? Also, is this the most common way of creating a means of searching a database?
Breaking Up The Query String Dynamicly?
using $Get_string = $_SERVER['QUERY_STRING']; to receive a query string such as month=may&$day=15&year=2006 so that $Get_string = "month=may&$day=15&year=2006" can I separate the values and turn them into variables? (like a normally would with a url get) $month = "may" $day= "15" etc it would be great to just do $_GET on the url but I'm sending the string as a variable to another script... so i can't just go the easy route.
Breaking The BACK Button (Refresh Problem)
I have a php page which serves up multiple pages based on how the user interacts with it - there are links on the first page that will reload (from the same php file) a new page with form fields and submit buttons, and when a user posts from that new page (or cancels), then the same php file is again loaded, detecting how the user responded and generating the appropriate html for whatever should be none next. All very typical. What I want to know is, is there a way so that once a user has posted from some submit button from one page (we'll say he Cancel's from a page that had a form Cancel button so he returns to the original non-form default page generated from the php file), can it be made so if the user then "refreshes" the new page (hits the Refresh or Reload browser button) he does NOT get the browser's "The page cannot be refreshed without resending the information. Click Retry to send the information again, or click Cancel to return to the page that you were trying to view." dialog? In other words, what I'd like is a way to have the browser think that there was no posting done (even though there was) once I've generated this certain 'home' page with my php code, so that user ReLoad's of the page won't get this warning. This is probably related also to problems I've had with "breaking the BACK button" on sequences of php pages: if the user BACK's up to a page that was generated by a post, it may not even be possible to regenerate the original page.
Return Data Breaking Input Field
My return data is: (I have nothing to do with how the og person choose to input this) <font color="#800080">CASE</font> and I am setting the value of a input text form field equal to that return $input = "<input type="text" name="queOpt". $i ."" value="". $this->_queArr[$i] ."" />"; im lost on how to fix this. addslashes doesnt make sense - maybe it is the double quote thing
Few Lines Of C++ To PHP
How would i do this in php ? (from borland c++) for (int i=1; i<=myString.Length(); ++i) { returnValue += StrToInt(AnsiString("0x" + (AnsiString)myString[i]));
Splitting Lines
I have a form with a textbox for an entire address and I want to split it into each line to print upon submission but don't know how! Can someone point me in the right direction? If it'd be easier to split it into separate lines I'll do that but I'd prefer to keep it as it is.
Delete New Lines
I would like to delete the new lines, I mean the, so Itried this: str_replace($row['facts_conten t'], " ", "") ; But the new lines are still there, how can I do?
Converting New Lines To <br>
I have some data contained in a mySQL table that contains line breaks. It's a snail-mail address. How can I have it so that when the data is recalled via PHP it puts a <br> where the newline is so that the data appears on a new line?
Number Of Lines
Is there a function that returns the number of lines in a text file? If so, what is it?
How To Number 42 Lines 1-14
I have 3 sonnets (14-line poems, fyi) in a file without blank lines and I want to tack line numbers onto the end of each line so that the first 14 lines will be numbered 1-14, as will the second 14 lines and the third. I've exploded the file by " " so that I have each line as an array value. I've been using various loop fuinctions (for, foreach, while) to try to put individual numbers at the end of each corresponding line, but something either loops too much or not at all. This is just an example. I know I could number 42 lines by hand, but I'd like an automated system to do it for much more line numbers.
Textarray And New Lines
I have a textarea in which users can enter text. When submitted the data is stored in a database. This works fine except when a new line is inserted (enter). This is not stored in the database. Is it possible to do this?
Matching Lines
I am trying to grab the lines from a textarea that match a substring. How best to implement this? I tried regex and failed miserably. Here I try to match every line with
New Lines In Form
it is time for some fine tuning of my application, after adding that banner script for which I needed percentage solution, I would like to fix my forum scripts... when someone write some text in form's textarea and then enter new line (btw, is that or or combination?) I'm not "getting" that new line but space. what can I do to "recieve" and store (in mysql db) text with newlines instead of spaces. and, even better, to replace that newline with </p> <p>...
Unexpected $ (about 70 Lines)
I get this error: Parse error: parse error, unexpected $ in [file] on line 63 Where [file] is the path and filename for a file containing: <?php function cityname($style="10engdir eng 50engloc"){//creates name for city return 'a city' }; function powercentres($pop){//determines power centres for a city return array(1=>array('name'=>'pc1','align'=>'true neutral','views'=>array(1=>'self'),'type'=>'conventional')); $pcs=array(); if($pop<=80){ $roll=rand(1,20); $align=rand(1,100); if($align<=35){ $pcs[1]=array('align'=>'lawful good'); }elseif($align<=39){ $pcs[1]=array('align'=>'neutral good'); }elseif($align<=41){ $pcs[1]=array('align'=>'chaotic good'); }elseif($align<=61){ $pcs[1]=array('align'=>'lawful neutral'); }elseif($align<=63){ $pcs[1]=array('align'=>'true neutral'); }elseif($align<=64){ $pcs[1]=array('align'=>'chaotic neutral'); }elseif($align<=90){ $pcs[1]=array('align'=>'lawful evil'); }elseif($align<=98){ $pcs[1]=array('align'=>'neutral evil'); }else{ $pcs[1]=array('align'=>'chaotic evil'); } if($roll-1<=13){ $pcs[1]['type']='conventional' if(rand(1,20)==1){ }elseif($roll-1<=18){ $pcs[1]['type']='nonstandard' }else{ $pcs[1]['type']='magical' } };
Empty Lines
i read the filr into an array using file(). some of the lines are empty. i would like to output the file but ignoring the emnpty lines.
New Lines In Forum
I've just made a forum. When entering text into a textarea for a post, i press enter to begin a new line but on viewing the post it puts the message on one single line which i don't want. How can i make it keep record of the user starting new lines.
Can I Read TextFiles By Lines With PHP
I will get via a submit button a lot of data to my PHP Script. Every variable contains a number which leads to line number in a textfile(readonly). It seems to be quite easy: i have my filepointer and then i thought the command "fgets" is doing this job for me but when i try $buffer=fgets($myFilePointer, $myLineNumber); i will just get the amount of characters from the first line defined in $myLineNumber. It seems to be so easy. How are you dealing with standard .conf Files? There they are doing the same (f.e. httpd.conf).
Open Multiple Lines Up
I have a form that fills itself out using php and mysql going by an id number out in by a user, but some users have more than one line of the form from the same number and all I can get to com up is the first line it comes to, how do i get it to get the lines?
Delete Lines From File:
How to delete $n first lines from $str if i know how much lines shuld remain in the string? $str = "aaaaaaaaa bbbbbbbb ccccccccc ddddddddd ... zzz"; Can it be done easly with preg_replace? (i.e without splitting it by '', removing elements from array and joining tham back.
Checking For Number Of Lines?
I have a problem. I have a static table cell (static meaning that it's dimensions do not change per amount of data) and i want to put news there. Via a mysql database i am outputting the news into this cell, but i want it to only allow enough so that it fits. Is there a way I can see how many lines a string has, or is there some other way to do this?
Stripping Out Spaces And New Lines
I am trying to write a script that will go in to an included php file, strip out some things and save it back out. So far, so good. The problem is when netscape navigator gold editor is used it does some things to the code that is creating havoc when the page is displayed. I wish that using that as an editor was NOT a choice but that is what the client uses sooooo... Anyway, here is the problem:
How To Count Lines From A Form?
I'm having trouble working this out ... Is there a simple way to count how many lines are returned in $_POST['myTextArea'] When I look at the $_POST all I see is one line yet there are three. I assume something is being interpreted differently depending on how I view it. Is there a simple funtion for this or can someone tell me how to work it out please?
Read First 10 Lines From A File
I have an ASCII file with each data record on a separateline. Each field is delimited with a TAB (ASCII 9) character. Now i want to read the first 10 lines and show them on my site. This is what i already have reading the first line: $fname = "http://www.somedomain.com/file.txt"; $fd = fopen($fname, "r"); if ($fd) { if (!feof ($fd)) { $buffer = fgets($fd, 4096); $field = split(chr(9), trim($buffer)); $field0 = "$field[0]"; $field1 = "$field[1]"; } fclose($fd); } echo ("$field0 - $field1"); How can i do this voor the first 10 lines?
Split A String Into Some More Lines
I have a problem with PHP. If I had a string with a lot of text, how can I then make a function, which can split the text up in some more lines, if I define how long the line have to be, and it shouldn't split up the words just when there are whitespaces...
Anti-Aliasing Of Lines In PHP Through GD
looking at the manual of GD, I see that there is the functionality to draw anti-aliased lines. However, in the recent PHP documentation, I can't find an appropriate image function to set anti-aliasing to TRUE. Can someone tell me the recent status of the PHP implementation on this?
Echo Multiple Lines At Once.
Some of the online docs say that you can use echo <<<END all sorts of text and statements... END; but if the following produces a parse error at line 14 which is the closing php tag. <?php echo <<<TT <tr> <td> <p>1. some text...</p> </td> <td> <p> <input type="radio" name="gs.$i" value="1"> </p> </td> </tr> TT; ?> Any suggestions, like don't use this tag?
How To Loop Through Lines In A File?
I have an array ($data_array) and I want to compare each line of a text file ($counter_file) to each element of the array (the array and the file are in sync line-for-line). But the file is very big and I don't want to read the entire file into an array. In the interest of efficiency, I thought I'd open the file as read only and loop through and compare each line to the array - since I have to open the file later in append mode, I thought something like this would work. But how do I advance the pointer to the next line in the file as the loop increments? $fp = fopen($counter_file, "r"); for (i=0; i < count($data_array); i++) { $recent_visit = fgets($fp); //<<== * ? // * how to go to next line as i increments? if ($recent_visit < TIME1h) { $dup_line = explode("|", $data_array[i]) $dup_ip = trim($dup_line[i]); if ($visip == $dup_ip) //no dupes within one hour { exit; } } else { break; } } $fp = fopen($counter_file, "a"); [append stuff to counter_file here]
Remove All Lines Starting With B
Say I have the following file - dummy.txt: a 4treg a sdfas a 4egdsag b 1111 a ergdsfg b 1111 c waefasdf How would I go about removing all the lines that begin with a b? I thought the following script (which I wrote with the intention of replacing all such lines with the empty string) would but apparently it doesn't: <? $contents = file_get_contents('dummy.txt'); echo ""; echo preg_replace('/^b.*? /','',$contents); ?>
Changing New Lines To Html
how would I go about changing the to a <br> command for a flat file system? When I say I mean when the user hits enter in a textarea I want it 2 store a <br> and not a in the text file.
|