[PHP] html tags
Hi everyone, A quick question about html tags and PHP. I have a text area where users can submit text, and I need them to able to have links in the text if they so choose. The contents get written to an ini style flat file database. The problem comes when I try to print that content back out from the file - I get a warning from the parse_ini_file() function: Warning: Error parsing ./data/events on line 9 in Unknown on line 0 Line 9 happens to be the line in the events file that contains the a href tag. I have tried to do a base64_encode() on the data from the text area, and then wrote it to the ini file encapsulated in double quotes. It still fails when I do the base64_decode(), except then I get nothing printed back to the browser. Any ideas? -Erich- ===CODE // Get the form variables $month = $_REQUEST['month']; $day = $_REQUEST['day']; $year = $_REQUEST['year']; $time = $_REQUEST['time']; $bands = $_REQUEST['bands']; $venue = $_REQUEST['venue']; $description = base64_encode($_REQUEST['description']); list_events() { $ALLEVENTS = parse_ini_file('./data/events', TRUE); while (list ($key, $value) = each ($ALLEVENTS)) { print 'br'; print 'table border=0 cellpadding=0 cellspacing=0 width=100% tr td bgcolor=#AA align=left font color=black size=2 Saje, Live at '.stripslashes($value['venue']). '/font /td td bgcolor=#AA align=right font color=black size=2'. $value['month'].'/'.$value['day'].'/'.$value['year'].'/font /td /tr tr td colspan=2 font color=#efa68aWith: '.stripslashes($value['bands']).'/fontbr brfont color=white'.base64_decode($value['description']). '/font/td /tr /table'; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Removing elements of multidimensional array
Hey everyone, I am reading an ini file into an array using the parse_ini_file() function. What I want to do is delete a section from the ini file, and thought that the best way to do it would be to unset one of the keys in the array returned by the parse function. I then want to write the modified array back out to the ini file. I am having a hard time doing the unset though - what am I missing? * CODE * // Parse out the events file $array = parse_ini_file('./data/events', TRUE); while($key = key($array)) { if ($key == $event) { unset($key); next($array); } else { next($array); } } // This prints the contents of the array, and the value that I tried to unset is still there... print_r($array); * END CODE * Thanks! -Erich- Never mind. I am SUCH a moron. // This works just fine... unset($array[$event]); -Erich-
[PHP] Removing elements of multidimensional array
Hey everyone, I am reading an ini file into an array using the parse_ini_file() function. What I want to do is delete a section from the ini file, and thought that the best way to do it would be to unset one of the keys in the array returned by the parse function. I then want to write the modified array back out to the ini file. I am having a hard time doing the unset though - what am I missing? * CODE * // Parse out the events file $array = parse_ini_file('./data/events', TRUE); while($key = key($array)) { if ($key == $event) { unset($key); next($array); } else { next($array); } } // This prints the contents of the array, and the value that I tried to unset is still there... print_r($array); * END CODE * Thanks! -Erich-
[PHP] parsing ini files
Hey everybody, I'm new the list and to PHP, so I thought I'd launch right in with a question. I have a file which contains the following syntax: ; Events listings [event] month = january day = 23 year = 2003 venue = some club description = this is an event [event] month = january day = 12 year = 2003 venue = another club description = this is another event Each one of these headers sections represents the start of a new event. So, my code does the following: $EVENTS = parse_ini_file('./data/events', TRUE); while($key = key($EVENTS)) { $$key = current($EVENTS); //variable variables next($EVENTS); } The problem is that when I try to print the values for $venue, $day, etc, I only get the values for the last section encountered. I need a way to get the values of all the events - do my section heads need to be unique, or can I continue to use the same format in my ini file? Thanks in advance! -Erich- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php