PHP - Insert Code Question..
I am showing Youtube videos on my site and am pulling the data in from an xml file... However this is the problem I'm having...
When I pull in the video the output is working correctly until you get the image file... it's HUGE... NOT what I wanted so I set about trying to figure out how to resize the image... I have tried many things but no luck. I don't have access to the google api to change the picture size sooooo... I"m trying to do so within the php I do have..here is what I have... $videos[$i]['img'] = $matches[0]; That output shows the HUGE picture.... Here is what I've tried to do ... $videos[$i]['img'] = $matches[0] "width=100px height=100px"; That is a no go... it crashes the site and I know it's a quote thing.. I do know that the first example outputs the image... or puts the img in a string to be output according to the video, I understand that. How do I resize the img to make it smaller? Here is the entire code for the parsing of the xml file.... <head> <link rel="stylesheet" href="modules/mod_jusertube/css/mediaboxAdvBlack21.css" type="text/css" media="screen" /> <script src="modules/mod_jusertube/js/mootools-more-1.3.js" type="text/javascript"></script> <script src="modules/mod_jusertube/js/mediaboxAdv-1.4.0.js" type="text/javascript"></script> <script src="modules/mod_jusertube/js/an7effects-1.5.5.js" type="text/javascript"></script> </head> <?php /** * @Copyright Copyright (C) 2010- Md. Afzal Hossain * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html **/ /* This file is part of mod_lcc. mod_lcc is free softwa you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. mod_lcc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with mod_lcc. If not, see <http://www.gnu.org/licenses/>. */ // no direct access defined('_JEXEC') or die('Restricted access'); class FeedReader { var $cachetime; var $filepath; function __construct($updatefeed = 300){ $this->cachetime = $updatefeed; $this->filepath = dirname(__FILE__).DS; } function get_youtube_top($youtubeuser,$totalvid){ $filename = $this->filepath.'youtube_'.$youtubeuser.'.xml'; if(is_file($filename)){ $utime = filemtime($filename); $chtime = time() - 60*$this->cachetime; if($utime>$chtime) $updated = true; else $updated = false; } else{ $updated = false; } if(!$updated){ $link="http://gdata.youtube.com/feeds/base/users/$youtubeuser/uploads?alt=rss"; $ch = curl_init($link); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); $data = curl_exec($ch); curl_close($ch); if(strlen($data)>100) file_put_contents($filename,$data); } if(is_file($filename)){ $data = file_get_contents($filename); } else{ return false; } $rss = new SimpleXMLElement($data); $i = 0; $videos = array(); foreach($rss->channel->item as $item){ //$guid_split = explode('/',$item->guid); //$videos[$i]['id'] = $guid_split[6]; $videos[$i]['title'] = (string) $item->title; $videos[$i]['link'] = (string) $item->link; //$videos[$i]['embed'] = '<object width="100" height="125"><param name="movie" value="http://www.youtube.com/watch/'.$guid_split[6].'"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/'.$guid_split[6].'" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="385"></object>'; $description = (string) $item->description; $matches = array(); preg_match("/<img[^<>]+>/",$description,$matches); $videos[$i]['img'] = $matches[0]; $i++; if($i>=$totalvid) break; } return $videos; } } Thanks guys!! Again! Similar TutorialsHi, I need to insert some code into my current form code which will check to see if a username exist and if so will display an echo message. If it does not exist will post the form (assuming everything else is filled in correctly). I have tried some code in a few places but it doesn't work correctly as I get the username message exist no matter what. I think I am inserting the code into the wrong area, so need assistance as to how to incorporate the username check code. $sql="select * from Profile where username = '$username'; $result = mysql_query( $sql, $conn ) or die( "ERR: SQL 1" ); if(mysql_num_rows($result)!=0) { process form } else { echo "That username already exist!"; } the current code of the form <?PHP //session_start(); require_once "formvalidator.php"; $show_form=true; if (!isset($_POST['Submit'])) { $human_number1 = rand(1, 12); $human_number2 = rand(1, 38); $human_answer = $human_number1 + $human_number2; $_SESSION['check_answer'] = $human_answer; } if(isset($_POST['Submit'])) { if (!isset($_SESSION['check_answer'])) { echo "<p>Error: Answer session not set</p>"; } if($_POST['math'] != $_SESSION['check_answer']) { echo "<p>You did not pass the human check.</p>"; exit(); } $validator = new FormValidator(); $validator->addValidation("FirstName","req","Please fill in FirstName"); $validator->addValidation("LastName","req","Please fill in LastName"); $validator->addValidation("UserName","req","Please fill in UserName"); $validator->addValidation("Password","req","Please fill in a Password"); $validator->addValidation("Password2","req","Please re-enter your password"); $validator->addValidation("Password2","eqelmnt=Password","Your passwords do not match!"); $validator->addValidation("email","email","The input for Email should be a valid email value"); $validator->addValidation("email","req","Please fill in Email"); $validator->addValidation("Zip","req","Please fill in your Zip Code"); $validator->addValidation("Security","req","Please fill in your Security Question"); $validator->addValidation("Security2","req","Please fill in your Security Answer"); if($validator->ValidateForm()) { $con = mysql_connect("localhost","uname","pw") or die('Could not connect: ' . mysql_error()); mysql_select_db("beatthis_beatthis") or die(mysql_error()); $FirstName=mysql_real_escape_string($_POST['FirstName']); //This value has to be the same as in the HTML form file $LastName=mysql_real_escape_string($_POST['LastName']); //This value has to be the same as in the HTML form file $UserName=mysql_real_escape_string($_POST['UserName']); //This value has to be the same as in the HTML form file $Password= md5($_POST['Password']); //This value has to be the same as in the HTML form file $Password2= md5($_POST['Password2']); //This value has to be the same as in the HTML form file $email=mysql_real_escape_string($_POST['email']); //This value has to be the same as in the HTML form file $Zip=mysql_real_escape_string($_POST['Zip']); //This value has to be the same as in the HTML form file $Birthday=mysql_real_escape_string($_POST['Birthday']); //This value has to be the same as in the HTML form file $Security=mysql_real_escape_string($_POST['Security']); //This value has to be the same as in the HTML form file $Security2=mysql_real_escape_string($_POST['Security2']); //This value has to be the same as in the HTML form file $sql="INSERT INTO Profile (`FirstName`,`LastName`,`Username`,`Password`,`Password2`,`email`,`Zip`,`Birthday`,`Security`,`Security2`) VALUES ('$FirstName','$LastName','$UserName','$Password','$Password2','$email','$Zip','$Birthday','$Security','$Security2')"; //echo $sql; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } else{ mail('email@gmail.com','A profile has been submitted!',$FirstName.' has submitted their profile',$body); echo "<h3>Your profile information has been submitted successfully.</h3>"; } mysql_close($con); $show_form=false; } else { echo "<h3 class='ErrorTitle'>Validation Errors:</h3>"; $error_hash = $validator->GetErrors(); foreach($error_hash as $inpname => $inp_err) { echo "<p class='errors'>$inpname : $inp_err</p>\n"; } } } if(true == $show_form) { ?> I use this type of a code to send automatic emails from my website: Code: [Select] $headers = ; $headers .= ; $to = ; Click here to go to Google. ", $headers); I am having hard time figuring out how to do hyperlink on words (like here). If I do something like this: Code: [Select] <a href='http://www.google.com'>here</a> it spits out that exact thing out. Thanks you for your input Hi I am having troubles inserting item into a table with a primary key in it.
My problem is that every time I added a row into a table without specifying the primary key, mysql will not add it to the next available id.
For example, I have 5 rows initially and I added 10 rows into my table by using the insert into query. However when I delete the 10 rows and add another row in, the id of the additional row will become 16 instead of 6.
FYI, this is a php page that inserts my data into the table.
hi, this piece of code is not working, is it ok? Code: [Select] $query1 = "SELECT * FROM members_copy WHERE RSUSER = '".$RSUSER."' AND RSPASS = '".$RSPASS."'"; $result1 = mysql_query($query1); $row1 = mysql_fetch_array($result1); $_SESSION['USERID']=$row1['USERID']; $_SESSION['rsTown']=$row1['rsTown']; $_SESSION['RSEMAIL']=$row1['RSEMAIL']; $_SESSION['RSUSER']=$row1['RSUSER']; $pSQL = "INSERT INTO favepub_copy (USERID,PUBID)"; $pSQL = $pSQL."SELECT ".$_SESSION['USERID'].", PUBID "; $pSQL = $pSQL."FROM pubs "; $pSQL = $pSQL."WHERE rsTown = '".$rsTown; //echo "hello world"; //echo $pSQL; //exit(); mysql_query($pSQL); My application just broke about 2 hours ago and for the life of me I don't know what I did to it?! (I was coding a different file, and when I tried to run the main - unrelated index.php - things stopped working?!) Here is a snippet of the suspect code... if ($rows == 0){ // Email and Username are available. // Add User to the database. $q = "INSERT INTO users(username, email, pass, first_name, last_name, date_expires) VALUES('$u', '$e', '" . get_password_hash($p) . "', '$fn', '$ln', ADDDATE(NOW()), INTERVAL 1 MONTH))"; $r = mysqli_query($dbc, $q); When I step through my code in NetBeans, the INSERT is failing and I don't know why because I haven't touched this code since this morning and it was working all day... Please help! TomTees i have this code... and i want to make it more dynamic.... Code: [Select] <?php $content = $content[1].$content[2].$content[3].$content[4].$content[5].$content[6].$content[7].$content[8].$content[9].$content[10].$content[11].$content[12] .$content[13].$content[14].$content[15].$content[16] .$content[17].$content[18].$content[19].$content[20].$content[21].$content[22].$content[23].$content[24]; $sql = mysql_query ("insert into database (content) values ('$content')") or die(mysql_error()); ?> for example... instead content[1]. content[2]. content[3] ...etc... i want something like this....... $content = $content[from 1 to 24]; or $content = $content[from 1 to 777]; any solutions? Hello, I am trying to get a news script to work, but I can't get it to insert anything into the database. I cannot figure it out for the life of me. Code: (newsupdate.php) [Select] <form name="shout" action="post.php" method="post"> <p><b>Name:</b><br/><input type="text" name="name" size="15"/></p> <p><b>Message</b>:<br/> <textarea wrap="physical" name="message" rows="3" cols="25">News goes here! </textarea></p> <p><input type="submit" value="Shout now!"/> <input type="reset" value="Clear"/></p> </form> Code: (post.php) [Select] <? $name = $_POST["name"]; $message = $_POST["message"]; include("dbconnect.php"); $date = date("M j y"); $menu = MYSQL_QUERY("INSERT INTO adminnews (id,name,date,message)". "VALUES ('NULL', '$name', '$date', '$message')"); echo("Shout-out added! You will be redirected to the main page shortly. If you are not, click <a href='index.php'>here</a>."); ?> dbconnect.php is just the configuration for connecting to the database, and I have checked that all ready. A log-in script uses it just fine. i am trying to insert data into a database with the following code <?php $first_name=$_POST['first_name']; $middle_name=$_POST['middle_name']; $last_name=$_POST['last_name']; $gender=$_POST['gender']; $file_number=$_POST['file_number']; $character=$_POST['character']; $diagnosis=$_POST['diagnosis']; $description=$_POST['description']; $day = $_POST['day']; $month = $_POST['month']; $year = $_POST['year']; $date = date("Y-m-d", mktime(0,0,0,$month, $day, $year)); $con = mysql_connect("localhost","fathersh_search","f33321rh"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("fathersh_childsearch", $con); $sql="INSERT INTO child_info (first_name,middle_name,last_name,gender,birthdate,character,diagnosis,description,file_number) VALUES ('$_POST[first_name]','$_POST[middle_name]','$_POST[last_name]','$_POST[file_number]','$_POST[gender]','$date','$_POST[character]','$_POST[diagnosis]','$_POST[description]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?> the error i get is Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'character,diagnosis,description,file_number) VALUES ('James','Anthony','Peters',' at line 1 Friends this is a very strange problem i,m facing i made a form by which you can enter comments to a topic i get the comment title and comment topic and date and the name and e mail of the one who insert a comment according to these variables $id1=$row2['id']; echo "$id1"; //Comment poster,s name $name =strip_tags(@$_POST['coname']); //Comment title $title =strip_tags(@$_POST['comtitle']); //ment poster,s email $mail =strip_tags(@$_POST['comemail']); //comment $com =strip_tags(@$_POST['limitedtextarea']); //comment,s date $d= date("Y-m-d"); notice that i,m printing the topic id and i used the variable $id1 to get it inorder to use it to show the comments for this topic later and it shows the right id for the shown topic then i used this code to insert these variable into the database if(isset($_POST['add']) and $_POST['add']=='comm'){ $insertcomm =mysql_query("INSERT INTO comments (com_name,com_title,com_mail,comment,com_date,tid) VALUES ('$name','$title','$mail','$com','$d','$id1')") or die("comments were not inserted"); if(isset($insertcomm)){ echo "comment inserted ";} } I have a download area in my index.php. I'd like to insert a row in the connected database when a user downloads a file. Here's what I have at the start of index.php: <?php session_start(); // start of script every time. // setup a path for all of your canned php scripts $php_scripts = '/home/larry/web/test/php/'; // a folder above the web accessible tree // load the pdo connection module require $php_scripts . 'PDO_Connection_Select.php'; require $php_scripts . 'GetUserIpAddr.php'; //******************************* // Begin the script here $ip = GetUserIpAddr(); if (!$pdo = PDOConnect("foxclone")): { echo "Failed to connect to database" ; exit; } else: { $filename = NULL; $stmt = $pdo->prepare("INSERT INTO download (IP_ADDRESS, FILENAME) VALUES (?, ?)"); $stmt->execute([$ip,$filename]) ; } endif; //exit(); ?> <DOCTYPE html> Here's what my download area looks like: <?php $files = glob('download/*.iso'); $file = $files[count($files) -1]; $filename = basename($file); ?> <div class="container"> <div class="divL"> <h3>Get the "<?php echo "{$filename}";?>" file (approx. 600MB)</h3> <center> <a href="<?php echo "/{$file}";?>"><img src="images/button_get-the-app.png" alt=""></a> </center> How do I execute "$stmt->execute([$ip,$filename]) ;" when the download button is pressed? Hi,
I'm really at a loss here.
I have queried a table to get an option list, which returns what I expect but I need to then add it to some current code instead of the fixed option list presented.
The syntax is beyond me.
Please see attached.
Any pointers would be great.
Attached Files
OptionList.txt 1.61KB
7 downloads Hello, i have this php code. Its for sms insertion of links in to table <table border="1"> <?PHP $db_user = 'user'; $db_pass = 'pass'; $db_name = 'name'; $db_host = 'localhost'; if(mysql_connect($db_host,$db_user,$db_pass)) { mysql_select_db($db_name); mysql_query("CREATE TABLE IF NOT EXISTS smsads(id bigint unsigned primary key auto_increment, link varchar(255), fromnum varchar(60))"); $res = mysql_query("SELECT * FROM smsads ORDER BY id DESC LIMIT 10"); while($row = mysql_fetch_object($res)) { $http_link = $row->link; if(strstr($http_link, 'http') === FALSE) $http_link = 'http://'.$http_link; echo "<tr><td><a href=\"{$http_link}\" target=\"_blank\">{$row->link}</a></td></tr>"; } } ?> </table> The problem is that i use tpl files for the visual part and all my other tables are in tpl. How can i insert the table above in my tpl file, whitout loosing its functions? Hello everybody, I can't seem to figure out why this insert code isn't working. I'm trying to create a database of US zip codes. I created this user interface (form) with nothing but a submit button to execute the insert query <div id="right_content" class=""> <h3> Insert Zips </h3> <form action = "insertzip1.php" method = "post"> <input type = "submit" name = "submit" value = "submit"/> </form> </div> <!--closes right content--> Well here is the insert query which is supposed to accomplish the task. I have just included a tiny subsets of all the zipcodes (the insertzip1.php page which is the value of the action attribute of the form). <php? if (isset($_POST['submit'])) { require ('config.php'); $query = "INSERT INTO zips (zip, lat, lon, city, state, county, z_type, xaxis, yaxis, zaxis, z_primary, worldregion, country, locationtext, location, population, housingunits, income, landarea, waterarea, decommisioned, militaryrestrictioncodes, decommisionedplace) VALUES ('00501', 40.81, -73.04, 'HOLTSVILLE', 'NY', 'SUFFOLK', 'UNIQUE', 0.22, -0.72, 0.65, 'Yes', 'NA', 'US', 'Holtsville, NY', 'NA-US-NY-HOLTSVILLE', '', 0, 0, '', '', 'No', '', ''), ('00501', 40.81, -73.04, 'I R S SERVICE CENTER', 'NY', 'SUFFOLK', 'UNIQUE', 0.22, -0.72, 0.65, 'No', 'NA', 'US', 'I R S Service Center, NY', 'NA-US-NY-I R S SERVICE CENTER', '', 0, 0, '', '', 'No', '', ''), ('00544', 40.81, -73.04, 'HOLTSVILLE', 'NY', 'SUFFOLK', 'UNIQUE', 0.22, -0.72, 0.65, 'Yes', 'NA', 'US', 'Holtsville, NY', 'NA-US-NY-HOLTSVILLE', '', 0, 0, '', '', 'No', '', ''), ('00544', 40.81, -73.04, 'IRS SERVICE CENTER', 'NY', 'SUFFOLK', 'UNIQUE', 0.22, -0.72, 0.65, 'No', 'NA', 'US', 'Irs Service Center, NY', 'NA-US-NY-IRS SERVICE CENTER', '', 0, 0, '', '', 'No', '', '') "; $result = mysql_query($query); header("Location: insertzipsuccess.php"); }else{ die ("Could not insert data because" . mysql_error());} ?> The insertzipsuccess.php page is simply a page that prints out a success message if the query is successfully executed. Well when I hit the submit button, I just get redirected to a blank insertzip1.php page Can anyone show me what I'm not doing right here? PS I already created the table with fields that correspond to all the fields I'm trying insert. Hi, I'm trying to copy some values from a table called "member" to a table called "report" when new members submit a php application form. I can't see what's wrong with it. I have attached screenshots of the 2 tables and their structure. Any help would be much appreciated. global $conn,$dal; $customerID = mysql_insert_id(); $strSQLInsert = "insert into report (appID, memberID, select_agent, agent_details, first_name, last_name, street_address, suburb, postcode) values (".$ID.", ".$ID.", '".$values["select_agent"]."', '".$values["agent_details"]."', '".$values["first_name"]."', '".$values["last_name"]."', '".$values["street_address"]."', '".$values["suburb"]."', '".$values["postcode"]."')"; db_exec($strSQLInsert,$conn); [attachment deleted by admin] Code: [Select] <?php require "db/config.php"; $fname = $_POST['fname']; $lname = $_POST['lname']; $country = $_POST['country']; $state = $_POST['state']; $city = $_POST['city']; $zcode = $_POST['zcode']; $address = $_POST['address']; $ppemail = $_POST['ppemail']; $pnumber = $_POST['pnumber']; $cemail = $_POST['cemail']; $url = $_POST['url']; $price = "$5.00"; $query = "INSERT INTO custpackage1000( id, FirstName, LastName, Country, State, City, ZipCode, Address, PayPalEmail, PhoneNumber, PrimaryEmail, WebsiteURL) VALUES ( '1', '$fname', '$lname', '$country', '$state', '$city', '$zcode', '$ppemail', '$pnumber', '$cemail', '$url')"; mysql_connect($host, $user, $pass) or die("<br /><br /><h1>Fatal error. Please contact support if this persists.</h1>"); mysql_select_db($dbname); mysql_query($query) or die ("could not open db".mysql_error()); sleep(2); ?> Why won't the code insert into my database upon submission of data? What am I doing wrong? Dear Friends, I am alot before doing the mixed content of php and HTML in single variable in PHP.. I could not get the data even though there is not SYNTAX error.. please look my code and advise
$htmlcontent .=" <tr> <td colspan=\"8\">".$details."></td> </tr>"; for($k=0;$k<count($reg_years[$details]);$k++) { $year = (int)($reg_years[$details][$k]); $singlecount[$year] = array_filter($result[$details],function($details1) use ($year){ return ($details1['reg_year'] == $year && $details1['bench_type'] == 1); }); $divisioncount[$year] = array_filter($result[$details],function($details2) use ($year){ return ($details2['reg_year'] == $year && $details2['bench_type'] == 2); }); $fullcount[$year] = array_filter($result[$details],function($details3) use ($year){ return ($details3['reg_year'] == $year && $details3['bench_type'] >= 3); }); $rpcount[$year] = array_filter($result[$details],function($rp) use ($year){ return ($rp['reg_year'] == $year && $rp['bench_type'] == 'RP'); }); $mjccount[$year] = array_filter($result[$details],function($mjc) use ($year){ return ($mjc['reg_year'] == $year && $mjc['bench_type'] == 'MJC'); }); $cocount[$year] = array_filter($result[$details],function($co) use ($year){ return ($co['reg_year'] == $year && $co['bench_type'] == 'X'); }); $total = 0; $total = (int)(count($singlecount[$year])+count($divisioncount[$year])+count($fullcount[$year])+count($rpcount[$year])+count($mjccount[$year])+count($cocount[$year])); $htmlcontent .=" <tr> <td>".$year."</td> <td align=\"center\"> if(count($singlecount[$year])>0) { echo (count($singlecount[$year])); } else { echo "-"; } </td> <td align=\"center\"> if(count($divisioncount[$year])>0) { ".count($divisioncount[$year])." } else { "-" } </td> <td align=\"center\"> if (count($fullcount[$year]) > 0) { echo (count($fullcount[$year])); } else { echo "-"; } </td > < td align =\"center\"> if(count($rpcount[$year])>0) { echo (count($rpcount[$year])); } else { echo " - "; } </td> <td align=\"center\"> if(count($mjccount[$year])>0) { echo (count($mjccount[$year])); } else { echo " - "; } </td> <td align=\"center\"> if(count($cocount[$year])>0) { echo (count($cocount[$year])); } else { echo " - "; } </td> <td align=\"center\"> echo $total; </td> </tr>"; } } $htmlcontent .= "</tbody></table>"; $mpdf = new \Mpdf\Mpdf(); $mpdf->WriteHTML($htmlcontent); $mpdf->Output(); Waiting for FAST reply
Thanks Anes I'd like to write - or acquire - code that displays a simple table (name, phone number, email address, plus a comments field) on a web page in a password-protected page and allows a user to add his own information, update it or delete it. I figure hundreds of people and companies have written something like this so I'd like to find either an example I can imitate or even an existing package that I can simply customize to the specifics for my own table. Can anyone help me with that? Or am I going to have to reinvent the wheel for the gazillionth time and write it myself? Hello, what this script does is it goes to a labeled directory and picks a random flv file to play, it works great with jw player on the same server. my problem is i have a "sever-A" that dont allow flv files, and a "server-B" that does. im trying to use this script to call random flv's from server-b to server-a to play them. but i get a browser error "directory not found". Is there something im missing here or its just not possible to call to another server using php? Here is a simple test page i was experimenting with below, any input on this would be greatly appreciated, thanks. <?php $imglist=''; //$img_folder is the variable that holds the path to the swf files. // see that you dont forget about the "/" at the end $img_folder = "http://www.mywebsite.com/dumppy"; mt_srand((double)microtime()*1000); //use the directory class $imgs = dir($img_folder); //read all files from the directory, ad them to a list while ($file = $imgs->read()) { if (eregi("flv", $file)) $imglist .= "$file "; } closedir($imgs->handle); //put all images into an array $imglist = explode(" ", $imglist); $no = sizeof($imglist)-2; //generate a random number between 0 and the number of images $random = mt_rand(0, $no); $image = $imglist[$random]; //display random swf ?> <HTML> <HEAD> <TITLE>Untitled</TITLE> <META NAME="GENERATOR" CONTENT="MAX's HTML Beauty++ 2004"> </HEAD> <BODY> <p><?echo $img_folder.$image?></p> </BODY> </HTML> I use this bbc code. This is bbccode_function.php: <?php function bbcode($input){ $input = strip_tags($input); $input = htmlentities($input); $search = array( '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[url=http://(.*?)\](.*?)\[\/url\]/is', '/\[font color=(.*?) size=(.*?) face=(.*?)\](.*?)\[\/font\]/is', '/\[h1\](.*?)\[\/h1\]/is', '/\[special\](.*?)\[\/hat\]/is' ); $replace = array( '<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<img src="$1">', '<a href="$1">$2</a>', '<font style="color:$1;font-size:$2;font-face:$3">$4</font>', '<h1>$1</h1>', '<a href="http://google.com" style="font-size:32pt;text-decoration:blink;color:#FF0099">$1</a>' ); return preg_replace($search,$replace,$input); } ?> And this is test page: <?php include "bbcode_function.php"; $var = "[b]text[/b]"; echo bbcode($var); ?> But when i put <br \> code in $var, it does not goes to new row. I use this bbc code in textarea, and i need when i go in new row in textarea to use that bbc code, or somehow to make that work :S How can i do that? Hello, I am writing a very basic quiz program. I have three pages. The Quiz page. The Process page. And the Results Page. I have the Quiz page's form "action" to the Process page where questions are checked and a score is determined. Then I want those results displayed on the results page. So basically I want to use the quiz page, and when it is submitted it should go to the Results page while having used the Process page. Right now I have the Process page "included" on both the quiz and results page to use variables and stuff. And the form action is set to the Process page. What do I need to add to get it to do what I described above? Thanks! |