Xarex 1 Report post Posted May 11, 2011 Just thought you all might find this link useful. I like to stick to one kind of coding system for my website. To switch back and forth between HTML and PHP (.html or .php) just seems unprofessional.So I wanted a site that could convert my Javascript / HTML code to PHP and found a great site here:http://forums.xisto.com/no_longer_exists/ paste your code in, select how you want to return it.. ::: choose echo which returns echo "my code";Awesome tool to have for php programmers who want to implement Javascript / HTML into their code.Hope you find this useful as well. Enjoy! Share this post Link to post Share on other sites
Quatrux 4 Report post Posted May 19, 2011 Nice tool, even though I prefer to write HTML in a PHP file like this: <?php// my PHP code?>my HTML<?php// my further PHP code?> and in this way if possible, you don't need to escape anything and with the right IDE you can get normal highlighting of the code... Also, in most major PHP IDE's this feature which that site includes are available, you just select text in an IDE and usually from a menu you can escape your code the way you want, by changing " to \" and etc.Furthermore, I usually like and encourage everyone to write PHP like this:<?phpecho '<div id="some_id">'. $some_content . '</div>';?> AND NOT<?phpecho "<div id=\"some_id\">$some_content</div>";?> Personally I think you avoid some problems you don't need and it usually looks better in an IDE enviroment and you can always refactor or do something with that php variable $ in an IDE rather than having it in "" (double quotes) as text and not recognizable from some panels that a variable is used. Share this post Link to post Share on other sites
annyphp 0 Report post Posted May 24, 2011 Hi, May be you can find some free php script on PHPKod.com <?php// ----------------------------------------------------------------------// Main HTML function// ----------------------------------------------------------------------function html($element, $content = null, $args = null) { // Opening $output = "\n" . '<' . $element; // Arguments if ($args != null && is_array($args)) { // Wofür? $args_num = count($args); foreach ($args as $key => $value) { $output .= ' ' .$key. '="' .$value. '"'; } } // Standalone arguments else if ($args != null && ! is_array($args)) { $output .= ' ' .$args; } // Closing tag for standalone tags if ( ! $content) { $output .= ' />' . "\n"; } // Closing tag else { $output .= '>' . trim($content) . '</' . $element . '>'; // $output .= '>' . "\n" . trim($content) . "\n" . '</' . $element . '>'; } return $output . "\n";}// ----------------------------------------------------------------------// HTML child functions// ----------------------------------------------------------------------function html_head($content, $args = null) { return html('head', $content, $args); }function html_body($content, $args = null) { return html('body', $content, $args); }function html_title($title) { return html('title', $title); }function html_h1($content, $args = null) { return html('h1', $content, $args); }function html_h2($content, $args = null) { return html('h2', $content, $args); }function html_h3($content, $args = null) { return html('h3', $content, $args); }function html_h4($content, $args = null) { return html('h4', $content, $args); }function html_h5($content, $args = null) { return html('h5', $content, $args); }function html_h6($content, $args = null) { return html('h6', $content, $args); }function html_p($content, $args = null) { return html('p', $content, $args); }function html_div($content, $args = null) { return html('div', $content, $args); }function html_header($content, $args = null) { return html('header', $content, $args); }function html_footer($content, $args = null) { return html('footer', $content, $args); }function html_section($content, $args = null) { return html('section', $content, $args); }function html_article($content, $args = null) { return html('article', $content, $args); }function html_aside($content, $args = null) { return html('aside', $content, $args); }function html_figure($content, $args = null) { return html('figure', $content, $args); }function html_legend($content, $args = null) { return html('legend', $content, $args); }function html_dialog($content, $args = null) { return html('dialog', $content, $args); }function html_span($content, $args = null) { return html('span', $content, $args); }function html_blockquote($content, $cite, $args = null) { if(isset($cite)) { $args['cite'] = $cite; } return html('blockquote', $content, $args); }function html_quote($content, $cite, $args = null) { if(isset($cite)) { $args['cite'] = $cite; } return html('blockquote', $content, $args); } function html_q($content, $cite, $args = null) { if(isset($cite)) { $args['cite'] = $cite; } return html('q', $content, $args); } // Alias for blockquotefunction html_code($content, $args = null) { return html('code', $content, $args); }function html_pre($content, $args = null) { return html('pre', $content, $args); }function html_dl($content, $args = null) { return html('dl', $content, $args); }function html_dt($content, $args = null) { return html('dt', $content, $args); }function html_dd($content, $args = null) { return html('dd', $content, $args); }function html_br($args = null) { return html('br', '', $args); }function html_hr($args = null) { return html('hr', '', $args); }function html_strong($content, $args = null) { return html('strong', $content, $args); }function html_em($content, $args = null) { return html('em', $content, $args); }function html_address($content, $args = null) { return html('address', $content, $args); }function html_abbr($content, $args = null) { return html('abbr', $content, $args); }function html_acronym($content, $args = null) { return html('acronym', $content, $args); }function html_samp($content, $args = null) { return html('samp', $content, $args); }function html_kbd($content, $args = null) { return html('kbd', $content, $args); }function html_dfn($content, $args = null) { return html('dfn', $content, $args); }function html_del($content, $args = null) { return html('del', $content, $args); }function html_ins($content, $args = null) { return html('ins', $content, $args); }function html_button($content, $args = null) { return html('button', $content, $args); }function html_link($content, $args = null) { return html('link', $content, $args); }function html_var($content, $args = null) { return html('var', $content, $args); }function html_mark($content, $args = null) { return html('mark', $content, $args); }function html_time($content, $args = null) { return html('time', $content, $args); }function html_meter($content, $args = null) { return html('meter', $content, $args); }function html_progress($content, $args = null) { return html('progress', $content, $args); }/* Vertragen noch speziellere Behandlung (vielleicht ausgelagert in Media.php) */function html_audio($args = null) { return html('audio', '', $args); }function html_video($args = null) { return html('video', '', $args); }// ----------------------------------------------------------------------// Form// ----------------------------------------------------------------------function html_form($fields, $args = null) { // Handle args if( ! isset($args['method'])) { $args['method'] = 'post'; } if( ! isset($args['action'])) { $args['action'] = $_SERVER['PHP_SELF']; } // Output return html('form', $fields, $args); }// ----------------------------------------------------------------------// Input fields// ----------------------------------------------------------------------function html_input($type = text, $name = null, $value = null, $args = null) { // Handle args if(isset($type)) { $args['type'] = $type; } if(isset($name)) { $args['name'] = format_value($name); } if(isset($value)) { $args['value'] = $value; } if( ! isset($args['id'])) { $args['id'] = format_value($name); } // Output return html('input', '', $args); }function html_input_text($name = null, $value = null, $args = null) { // Handle args $args['type'] = 'text'; if(isset($name)) { $args['name'] = $name; } if(isset($value)) { $args['value'] = $value; } // Output return html('input', '', $args); }function html_input_password($name = null, $value = null, $args = null) { // Handle args $args['type'] = 'password'; if(isset($name)) { $args['name'] = $name; } if(isset($value)) { $args['value'] = $value; } // Output return html('input', '', $args); }// ----------------------------------------------------------------------// Aliases for html_input($type, $name, $value)// ----------------------------------------------------------------------function html_input_checkbox($name, $value = null, $args = null) { return html_input('checkbox', $name, $value, $args); }function html_input_radio($name, $value = null, $args = null) { return html_input('radio', $name, $value, $args); }function html_input_submit($text = 'Submit', $args = null) { return html_input('submit', 'submit_button', $text, $args); }function html_input_reset($text = 'Reset', $args = null) { return html_input('reset', 'reset_button', $text, $args); }function html_input_hidden($name, $value, $args = null) { return html_input('hidden', $name, $value, $args); }// ----------------------------------------------------------------------// UNCOMPLETE: Aliases for new HTML5 Form Elements// ----------------------------------------------------------------------function html_input_date($name, $value, $args) { return html_input('date', $name, $value, $args); };// ----------------------------------------------------------------------// Textarea// ----------------------------------------------------------------------function html_textarea($name = null, $value = ' ', $args = null) { // Handle args if(isset($name)) { $args['name'] = format_value($name); } // Output a space if no value is given if($value == '') { $value = ' '; } // ID if( ! isset($args['id'])) { $args['id'] = format_value($name); } // Output return html('textarea', $value, $args);}// ----------------------------------------------------------------------// Select// ----------------------------------------------------------------------function html_select($name, $options_array, $args = null) { $options = ''; $opt_count = 0; foreach($options_array as $title => $value) { // fals $options_array eindimensional (ohne values) if(is_integer($title)) { $title = $value; $value = $opt_count; } $opt_args['value'] = $value; $options .= html('option', $title, $opt_args); $opt_count++; } if( ! isset($args['name'])) { $args['name'] = $name; } return html('select', $options, $args);}// ----------------------------------------------------------------------// Label// ----------------------------------------------------------------------function html_label($label, $for = null, $args = null) { if(isset($for)) { $args['for'] = $for; } return html('label', $label, $args);}// ----------------------------------------------------------------------// Fieldset// ----------------------------------------------------------------------function html_fieldset($content, $args = null) { return html('fieldset', $content, $args); }// ----------------------------------------------------------------------// Formfield Wrapper// ----------------------------------------------------------------------function html_formfield_wrapper($name, $content, $args = null) { if($name != '') { $content = html_label($name, format_value($name)) . $content; $args['id'] = 'field-' . format_value($name); } $args['class'] = 'form-field'; return html_div($content, $args);}/*html_formfield()UNDER DEVELOPMENTDas soll eine Form Field-Funktion für alle Felder werden.Nötig?*/function html_formfield($options) { $field = html_label($options['name']); // $field .= '<label for="'.$options['name'].'">'.$options['name'].'</label>'; switch($options['type']) { case 'text': $field .= html_input_text($options['name'], $options['value'], $options['args']); break; case 'textarea': $field .= html_textarea($options['name'], $options['value'], $options['args']); break; // Checkbox & Radio müssen anders gelöst werden } return html_div($field, array('class' => 'form-field'));}/* Returns the opening tag of a form. *//* kann nicht per html() gemacht werden, wegen des / bei Inline-Elementen */function html_form_open($name = null, $args = null) { if(isset($name)) { $args['name'] = $name; $args['id'] = $name; } if( ! isset($args['method'])) { $args['method'] = 'post'; } if( ! isset($args['action'])) { $args['action'] = $_SERVER['PHP_SELF']; } $output = '<form '; foreach($args as $key => $value) { $output .= ' ' .$key. '="' .$value. '"'; } $output .= '>'; return $output;}function html_form_close() { return '</form>'; }class HTMLForm{ function field($field) { $this->fields .= $field; } function output() { return html_form( $this->fields . html_input_submit() ); }}// Funktioniert noch nicht:function html_jumpmenu($options_array, $select_args = null) { $args['name'] = 'Jumpmenu'; $select_args['name'] = 'Menu'; $select_args['value'] = 'GO'; $select_args['onChange'] = 'location=document.Jumpmenu.Menu.options[document.Jumpmenu.Menu.selectedIndex].value;'; return html_form(html_select($name, $options_array, $select_args), $args);}// ----------------------------------------------------------------------// Images//// Example:// print html_img('apple.jpg');// outputs:// <img src="apple.jpg" width="166" height="191" alt="apple.jpg" title="apple.jpg" /> //function html_img($src, $args = null) { // Title if( ! $args['title']) { $title = basename($src); } else { $title = $args['title']; } // Alt if( ! $args['alt']) { $alt = $title; } else { $alt = $args['alt']; } // Get image info $info = getimagesize($src); // Width if( ! $args['width']) { $width = $info['0']; } else { $width = $args['width']; } // Height if( ! $args['height']) { $height = $info['1']; } else { $height = $args['height']; } return html('img', '', array('src' => $src, 'width' => $width, 'height' => $height, 'alt' => $alt, 'title' => $title));}// Alias for html_img()function image($src, $args = null) { return img($src, $args); }// ----------------------------------------------------------------------// Links//function html_a($href, $text = null, $args = null) { // href if($href == "index" or $href == "home") { // './' ersetzen durch $basepath oder sowat $args['href'] = './'; } else { // $href beginnt nicht mit "http://" (case insensitiv) if( ! preg_match("/^http:\/\//i", $href)) { // $href beginnt mit "www" (case insensitiv) if(preg_match("/^www/i", $href)) { $args['href'] = ereg_replace("www", "http://www", $href); } // $href beginnt mit Punkt (relativer Link) else if(preg_match("/^./i", $href)) { $args['href'] = $href; } // $href beginnt nicht mit "www" (case insensitiv) else { $args['href'] = "http://forums.xisto.com/no_longer_exists/; } } else { $args['href'] = $href; } } // target if( ! isset($args['target']) or $args['target'] == "self") { $args['target'] = "_self"; } elseif($args['target'] == "blank" or $args['target'] == "new") { $args['target'] = "_blank"; } // text if($text == null) { $text = "$href"; } // title if( ! isset($args['title'])) { $args['title'] = $text; } else { $args['title'] = $args['title']; } // --------------------------------------------------------------------- // DEV: // MAILTO-Links // $href beginnt mit "mailto:" (case insensitiv) if(preg_match("/^mailto:/i", $args['href'])) { $args['title'] = ereg_replace("mailto:", "", $args['title']); } if(preg_match("/^mailto:/i", $text)) { $text = ereg_replace("mailto:", "", $text); } // --------------------------------------------------------------------- // output return html('a', $text, $args);}// ----------------------------------------------------------------------// Mailto() // Sollte idealerweise in a() implementiert sein (angefangen - args fehlen noch)// ----------------------------------------------------------------------function mailto($address, $text = null, $args = null) { $mail_args = array(); // in subject und body sollten noch leerzeichen und sonderzeichen umgewandelt werden if(isset($args['subject'])) { $mail_args['subject'] = $args['subject']; unset($args['subject']); } if(isset($args['body'])) { $mail_args['body'] = $args['body']; unset($args['body']); } if(isset($args['cc'])) { $mail_args['cc'] = $args['cc']; unset($args['cc']); } if(isset($args['bcc'])) { $mail_args['bcc'] = $args['bcc']; unset($args['bcc']); } // build href $args['href'] = 'mailto:'.$address; if(count($mail_args > 0)) { $args['href'] .= '?'; // Wieso wird das auch ohne $mail_args ausgeworfen? foreach($mail_args as $key => $value) { $args['href'] .= $key.'='.$value.'&'; } } if( ! isset($text)) { $text = $address; } return html('a', $text, $args);}// ----------------------------------------------------------------------// Listen// ----------------------------------------------------------------------function html_list($list_type, $items, $args = null) { $list_items = null; foreach($items as $key => $value) { $list_items .= html('li', $value); } $list = html($list_type, $list_items, $args); return $list;}function html_ul($items, $args = null) { return html_list('ul', $items, $args); }function html_ol($items, $args = null) { return html_list('ol', $items, $args); }function html_li($content, $args = null) { return html('li', $content, $args); }// ----------------------------------------------------------------------// Advanced list// ----------------------------------------------------------------------// Diese Weiterentwicklung nutzt die Möglichkeit einer Funktion eine// unbegrenzte Anzahl von Argumenten zu übergeben.// So muss für die Listen-Items kein Array mehr verwendet werden.// Ist ein Argument ein Array, wird es automatisch als Argumentenkette// des vorherigen List-Items genutzt (bis auf das erste Argument - das// wird als Argumentenkette für die umschlieÃende Liste genutzt).//// @Example:// new_html_list(// array('id' => 'my-list'),// eins,// zwei, array('id' => 'second-item', 'class' => 'list-items'),// drei// );//// @ToDo:// Implementierung des Listen-Typs zur "Vererbung" an ul() und ol().// Ansonsten scheint es recht fertig.function html_adv_list() { $args = func_get_args(); $list_type = array_shift($args[0]); // Wenn das erste Argument ein Array ist, wird es als Argumenten- // Kette für die Liste benutzt. if(is_array($args[0])) { $argument_1 = array_shift($args); foreach($argument_1 as $key => $value) { $list_args[$key] .= $value; } } $li_num = 0; foreach($args as $key => $value) { $li_num ++; // Argument ist ein Listenpunkt (kein Array) if( ! is_array($args[($li_num-1)])) { $li_content = $value; } // Argument ist ein Argumenten-Array else { foreach($value as $key2 => $value2) { $li_args[$key2] .= $value2; } } // Der Array-Key ist jeweils eins unter dem $li_num // (der bei eins, anstatt 0 beginnt) $next_li = $li_num; if( ! is_array($args[$next_li])) { $list_items .= html('li', $li_content, $li_args); $li_args = ''; } } return html($list_type, $list_items, $list_args);}function html_adv_ul($items) { return html_adv_list('ul', $items); }function html_adv_ol($items) { return html_adv_list('ol', $items); }// ----------------------------------------------------------------------// Tables// ----------------------------------------------------------------------// To Do://// - thead, tbody, tfoot so anlegen, das der Head autom. oben, der Foot // automatisch unten ausgegeben wird.// - html() nutzen// - Funktion von dieser Klasse ableiten:// table(// array('head_item_1', 'head_item_2', 'head_item_3'), // array('tr_item_1', 'tr_item_2', 'tr_item_3'), // array('foot_item_1', 'foot_item_2', 'foot_item_3') // );class HTMLTable { function __construct($cols = '') { $this->table = ''; if($cols) { $this->head($cols); } } function row($tag, $cols, $container_tag = '') { if($container_tag != '') { $this->table .= '<' . $container_tag . '>'; } $this->table .= '<' . $tag . '>'; foreach($cols as $col) { $this->table .= '<td>' . $col . '</td>'; $this->table .= "\n"; } $this->table .= '</' . $tag . '>'; $this->table .= "\n"; if($container_tag != '') { $this->table .= '</' . $container_tag . '>'; $this->table .= "\n"; } } function head($cols) { $this->row('tr', $cols, 'thead'); } function foot($cols) { $this->row('tr', $cols, 'tfoot'); } /* Noch ohne Sinn, weil trs und rows dem tbody nicht zugeordnet werden können */ function body($cols) { $this->row('tr', $cols, 'tbody'); } function tr($cols) { $this->row('tr', $cols); } function display($args = '') { return html('table', $this->table, $args); }}/* ------------------------------------------------------------------object( 'file.swf', array('width' => '220'), array('paramname' => 'paramwert'))generiert:<object width="220"><param name="paramname" value="paramwert" />Your browser cant show this object.</object>*/function html_object($filename, $args = null, $params = null, $alt_text = 'Your browser cant show this object.'){ $args['data'] = $filename; if(is_array($params)) { $params_string = ''; foreach($params as $key => $value) { $param_args['name'] = $key; $param_args['value'] = $value; $params_string .= html('param', '', $param_args)."\n"; } } $content = (isset($params_string)) ? $params_string : ''; $content .= $alt_text; return html('object', $content, $args); }/* --------------------------------------------------------------------------Head helper-------------------------------------------------------------------------- */function html_doctype($type = 'html5') { switch($type) { case 'transitional': return '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://forums.xisto.com/no_longer_exists/;; break; case 'strict': return '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://forums.xisto.com/no_longer_exists/;; break; case 'html5': return '<!DOCTYPE html>'; break; }}function html_link_css($files, $media = null) { if( ! is_array($files)) { if($media == null) { $media = 'screen'; } $css_file = $files; $output = html('link', '', array('href' => $css_file, 'media' => $media, 'rel' => 'stylesheet', 'type' => 'text/css')); } else { foreach($files as $key => $value) { if(is_int($key)) { $media = 'screen'; $css_file = $value; } else { $media = $value; $css_file = $key; } $output = html('link', '', array('href' => $css_file, 'media' => $media, 'rel' => 'stylesheet', 'type' => 'text/css')); } } return $output;} function html_link_js($file) { return html('script', ' ', array('src' => $file, 'type' => 'text/javascript')); }function html_style($css) { return html('style', '<!--'."\n".$css."\n".'-->', array('type' => 'text/css')); }function html_css($css) { return html_style($css); }function html_js($js) { return html('script', '<!--'."\n".$js."\n".'-->', array('type' => 'text/javascript')); }function html_javascript($script) { return html_js($script); } // Alias for js()// ----------------------------------------------------------------------// Helper// ----------------------------------------------------------------------function html_clear($element = 'br', $content = null, $args = null) { $args['style'] = 'clear: both;'; return html($element, $content, $args); }function html_comment($comment) { return "\n" . '<!-- ' . $comment . ' -->' . "\n";}function html_js_alert($string) { return js('alert("'.$string.'")');}function html_page($title, $body, $options = null) { $page = $page = doctype(). html('html', head(title($title).css($options['css'])). body($body) ); return $page;}// ----------------------------------------------------------------------// Layout// ----------------------------------------------------------------------class HTMLCols{ function __construct() { $this->col_num = 0; } function col($content) { $this->col_num ++; $this->collumns[] = $content; } function display() { /* switch($this->col_num) { case 1: $this->col_width = '100%'; break; case 2: $this->col_width = '49.5%'; break; case 3: $this->col_width = '32.5%'; break; case 4: $this->col_width = '24.5%'; break; case 5: $this->col_width = '19.5%'; break; case 6: $this->col_width = '16.5%'; break; } */ $this->col_width = 100 / $this->col_num . '%'; $num = 0; $output = ''; foreach($this->collumns as $key => $value) { $num ++; $output .= html_div($value, array('style' => 'float: left; width: '.$this->col_width, 'id' => 'col-'.$num)); } $output .= html_clear(); return $output; }}function html_cols() { $contents = func_get_args(); $layout = new HTMLCols; foreach($contents as $value) { $layout->col($value); } return $layout->display();}class HTMLPage { function __construct($title = '') { $this->head = ''; $this->title = $title; $this->charset = 'UTF-8'; $this->body = ''; $this->bodyArgs = array(); } function addHead($head_content) { $this->head .= $headContent; } function addJS($js) { $this->js .= $js; } function addStylesheet($stylesheet_file, $media = 'screen') { // $this->stylesheets .= linkCSS($stylesheet_file, $media); $this->stylesheets .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet_file.'" media="'.$media.'" />'; $this->stylesheets .= "\n"; } function addStyle($styleContent) { $this->style .= $styleContent; $this->style .= "\n"; } function addCSS($selector, $values) { $this->css .= $selector .' { '; if($values != '' && is_array($values)) { foreach($values as $key => $value) { $this->css .= $key. ': ' .$value. '; '; } } $this->css .= '}'; $this->css .= "\n"; } function addJSFile($file) { $this->js_files .= '<script src="'.$file.'" type="text/javascript"></script>' . "\n"; } function addTitle($title) { $this->title .= $title; } function addCharset($charset) { $this->charset = $charset; } function addBody($bodyContent, $bodyArgs = '') { $this->body .= $bodyContent; $this->bodyArgs .= $bodyArgs; } function addBodyArgs($bodyArgs) { $this->bodyArgs .= $bodyArgs; } function output() { print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://forums.xisto.com/no_longer_exists/;; print "\n\n"; print "<html>\n\n"; print "<head>\n"; if($this->title != '') { print '<title>' . $this->title . '</title>'; } print "\n"; print '<meta http-equiv="Content-Type" content="text/html; charset='.$this->charset.'"/>'; print "\n"; if($this->stylesheets != '') { print "\n"; print $this->stylesheets; print "\n"; } if($this->js_files != '') { print "\n"; print $this->js_files; print "\n"; } if($this->style != '' or $this->css != '') { print '<style type="text/css">'; print "\n"; print '<!--'; print "\n"; print $this->css; print $this->style; print '-->'; print "\n"; print '</style>'; print "\n"; } if($this->js != '') { print '<script type="text/javascript">'; print "\n"; print '<!--'; print "\n"; print $this->js; print '-->'; print "\n"; print '</script>'; print "\n"; } print $this->head; print "</head>\n\n"; print "<body"; if($this->bodyArgs != '' && is_array($this->bodyArgs)) { foreach($this->bodyArgs as $key => $value) { print ' ' .$key. '="' .$value. '"'; } } print ">\n\n"; print $this->body; print "\n\n</body>\n\n"; print "</html>\n"; }}/*$page = new HTMLPage('My Page');$page->addCSS('a', array('font-family'=>'arial'));$page->addStyle('* { font-family: arial; color: #333 }');$page->addStyle('a { font-weight: bold; color: #09f }');$page->addBody( link('fatboy.jpg'). image('fatboy.jpg'). $table->display(array('class'=>'pretty_table')) );$page->addBodyArgs(array('id'=>'my_page'));$page->render();*/// ----------------------------------------------------------------------// Format Helper// ----------------------------------------------------------------------function format_value($string) { $string = str_replace(' ', '_', $string); $string = strtolower($string); return $string;}?> Share this post Link to post Share on other sites