PHP - Adding Extra On Filenames
Hello PHPFreaks!
I have a question for somebody to answer Code: [Select] <?php //This is the directory where images will be saved $target = "gallery/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $username=$_POST['username']; $photo=($_FILES['photo']['name']); $caption=$_POST['caption']; $ip=$_POST['ip']; //Writes the information to the database mysql_query("INSERT INTO `photo` (username, photo, caption, ip) VALUES ('$username', '$photo', '$caption', '$ip')") ; //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your caption has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?> When pictures are uploaded; they upload the name they have named them. Is it possible to add to the script $username somewhere to the file name? For example; DSC_0077_SOLAR.JPG Thanks for your time! Similar TutorialsArray(2) and others are just an empty array for some reason i do think it is to do with the preg_replace but don't have enough of an understanding about it to sort it out any help would be appreciated i don't particularly know if i need preg replace but i have tried with out it or other options and nothing has worked so far. Heres the code Code: [Select] <?php $file = "widget.csv"; $delimiter = ","; $enclosure = '"'; @$fp = fopen($file, "r") or die("Could not open file for reading"); while (!feof($fp)) { $tmpstr = fgets($fp, 100); $shop[] = preg_replace("//", "", $tmpstr); /* $tmpstr = $shop; */ } for ($i=0; $i < count($shop); $i++) { $shop[$i] = explode($delimiter, $shop[$i]); } print_r ($shop); echo "<h1>Manual access to each element</h1>"; echo $shop[0][0]." costs ".$shop[0][1]." and you get ".$shop[0][2]."<br />"; echo $shop[1][0]." costs ".$shop[1][1]." and you get ".$shop[1][2]."<br />"; echo $shop[2][0]." costs ".$shop[2][1]." and you get ".$shop[2][2]."<br />"; echo "<h1>Using loops to display array elements</h1>"; echo "<table>"; /* for ($row = 0; $row < 3; $row++) */ for ($row=0; $row<count($shop); $row++) { echo "<th colspan='3'><b>" . $shop[$row][0]."</b></th>"; echo "<tr>"; /* for ($col = 1; $col < 6; $col++) */ for ($col=1; $col < count($shop); $col++) { echo "<td>".$shop[$row][$col]."</td>"; } echo "</tr>"; /* echo "</li>"; */ } echo "</table>"; ?> This is the CSV File widget.csv Quote A,Airlie Beach,Andergrove,Alexandra,Armstrong Beach,Alligator Creek,,,,,,,,,,,,,, B,Bucasia,Blacks Beach,Beaconsfield,Bakers Creek,Balberra,Bloomsbury,Breadalbane,Ball Bay,Belmunda,,,,,,,,,, C,Cannonvale,Calen,Crystal Brook,Cremorne,Chelona,Campwin Beach,Cape Hillsborough,Conway,,,,,,,,,,, D,Dows Creek,Dumbleton,Dolphin Heads,,,,,,,,,,,,,,,, E,Eimeo,Eton,Erakala,,,,,,,,,,,,,,,, F,Foulden,Foxdale,Flametree,Farleigh,Freshwater Point,,,,,,,,,,,,,, G,Glen Isla,Glenella,,,,,,,,,,,,,,,,, H,Homebush,Hampden,,,,,,,,,,,,,,,,, I,,,,,,,,,,,,,,,,,,, J,Jubilee Pocket,,,,,,,,,,,,,,,,,, K,Kinchant Dam,Kolijo,Koumala,Kuttabul,,,,,,,,,,,,,,, L,Laguna Quays,,,,,,,,,,,,,,,,,, M,McEwens Beach,Mackay,Mackay Harbour,Mandalay,Marian,Mia Mia,Middlemount,Midge Point,Mirani,Moranbah,Mount Charlton,Mount Jukes,Mount Julian,Mount Marlow,Mount Martin,Mount Ossa,Mount Pelion,Mount Pleasant,Mount Rooper N,Narpi,Nebo,Nindaroo,North Eton,,,,,,,,,,,,,,, O,Oakenden,Ooralea,,,,,,,,,,,,,,,,, P,Palmyra,Paget,Pindi Pindi,Pinevale,Pioneer Valley,Pleystowe,Preston,Proserpine,,,,,,,,,,, Q,,,,,,,,,,,,,,,,,,, R,Racecourse,Richmond,Riordanvale,Rosella,Rural View,,,,,,,,,,,,,, S,St Helens Beach,Sandiford,Sarina,Seaforth,Slade Point,Shoal Point,Shute Harbour,Shutehaven,Strathdickie,Sugarloaf,Sunnyside,,,,,,,, T,Te Kowai,The Leap,,,,,,,,,,,,,,,,, U,,,,,,,,,,,,,,,,,,, V,Victoria Plains,,,,,,,,,,,,,,,,,, W,Wagoora,Walkerston,Woodwark,,,,,,,,,,,,,,,, X,,,,,,,,,,,,,,,,,,, Y,Yalboroo,,,,,,,,,,,,,,,,,, Z,,,,,,,,,,,,,,,,,,, It is generating this as the output of the Array as this but the array(2) and others as you can see are empty C should of been the first one after B field had finished. Quote Array ( [0] => Array ( [0] => A [1] => Airlie Beach [2] => Andergrove [3] => Alexandra [4] => Armstrong Beach [5] => Alligator Creek [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [1] => Array ( [0] => B [1] => Bucasia [2] => Blacks Beach [3] => Beaconsfield [4] => Bakers Creek [5] => Balberra [6] => Bloomsbury [7] => Breadalbane [8] => Ball Bay [9] => Belmunda [10] => ) [2] => Array ( [0] => [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => ) [3] => Array ( [0] => C [1] => Cannonvale [2] => Calen [3] => Crystal Brook [4] => Cremorne [5] => Chelona [6] => Campwin Beach [7] => Cape Hillsborough [8] => Conway [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [4] => Array ( [0] => ) [5] => Array ( [0] => D [1] => Dows Creek [2] => Dumbleton [3] => Dolphin Heads [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [6] => Array ( [0] => E [1] => Eimeo [2] => Eton [3] => Erakala [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [7] => Array ( [0] => F [1] => Foulden [2] => Foxdale [3] => Flametree [4] => Farleigh [5] => Freshwater Point [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [8] => Array ( [0] => G [1] => Glen Isla [2] => Glenella [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [9] => Array ( [0] => H [1] => Homebush [2] => Hampden [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [10] => Array ( [0] => I [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [11] => Array ( [0] => J [1] => Jubilee Pocket [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [12] => Array ( [0] => K [1] => Kinchant Dam [2] => Kolijo [3] => Koumala [4] => Kuttabul [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [13] => Array ( [0] => L [1] => Laguna Quays [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [14] => Array ( [0] => M [1] => McEwens Beach [2] => Mackay [3] => Mackay Harbour [4] => Mandalay [5] => Marian [6] => Mia Mia [7] => Middlemount [8] => Midge Point [9] => Mirani [10] => Moranb ) [15] => Array ( [0] => ah [1] => Mount Charlton [2] => Mount Jukes [3] => Mount Julian [4] => Mount Marlow [5] => Mount Martin [6] => Mount Ossa [7] => Mount Pelion [8] => Mount ) [16] => Array ( [0] => Pleasant [1] => Mount Rooper ) [17] => Array ( [0] => N [1] => Narpi [2] => Nebo [3] => Nindaroo [4] => North Eton [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [18] => Array ( [0] => O [1] => Oakenden [2] => Ooralea [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [19] => Array ( [0] => P [1] => Palmyra [2] => Paget [3] => Pindi Pindi [4] => Pinevale [5] => Pioneer Valley [6] => Pleystowe [7] => Preston [8] => Proserpine [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [20] => Array ( [0] => Q [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [21] => Array ( [0] => R [1] => Racecourse [2] => Richmond [3] => Riordanvale [4] => Rosella [5] => Rural View [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [22] => Array ( [0] => S [1] => St Helens Beach [2] => Sandiford [3] => Sarina [4] => Seaforth [5] => Slade Point [6] => Shoal Point [7] => Shute Harbour [8] => Shutehaven [9] => Strath ) [23] => Array ( [0] => dickie [1] => Sugarloaf [2] => Sunnyside [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => ) [24] => Array ( [0] => T [1] => Te Kowai [2] => The Leap [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [25] => Array ( [0] => U [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [26] => Array ( [0] => V [1] => Victoria Plains [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [27] => Array ( [0] => W [1] => Wagoora [2] => Walkerston [3] => Woodwark [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [28] => Array ( [0] => X [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [29] => Array ( [0] => Y [1] => Yalboroo [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) [30] => Array ( [0] => Z [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) ) Hi, I have the following situation: Code: [Select] Array ( [5] => GeoLiteCity_20090601.zip [6] => GeoLiteCity_20090701.zip [7] => GeoLiteCity_20090801.zip [8] => GeoLiteCity_20090901.zip [9] => GeoLiteCity_20091001.zip [10] => GeoLiteCity_20091101.zip [11] => GeoLiteCity_20091201.zip [12] => GeoLiteCity_20100101.zip [13] => GeoLiteCity_20100201.zip [14] => GeoLiteCity_20100301.zip [15] => GeoLiteCity_20100401.zip [16] => GeoLiteCity_20100501.zip [17] => GeoLiteCity_20100601.zip [18] => GeoLiteCity_20100701.zip [19] => GeoLiteCity_20100801.zip [20] => GeoLiteCity_20100901.zip [21] => GeoLiteCity_20101001.zip [22] => GeoLiteCity_20101101.zip [23] => GeoLiteCity_20101201.zip ) I have this array with filenames, the patern for the name of the file is NAME_DATE.zip I need to get from this array the most recent file(GeoLiteCity_20101201.zip). Which is the best way of doing this task? Give me some clues. Best Regards, I could use some help on naming my PHP files... The approach I have settled on for now is that I have some PHP page that does something (e.g. "change_password.php") and then another page to which the user is redirected (e.g. "change_password_results.php") which displays an outcome message like "Your Password has been re-set." Questions: 1.) Is it a problem having multi-word PHP File Names? 2.) Is it a problem separating them with underscores? 3.) Will it look *strange* to users looking at the URL to see a file name like "create_account_results.php" ?? 4.) Will this impact SEO? Thanks, Debbie Hi, I've tried various methods (ie. glob etc.) but haven't had any success, the purpose is to scan through all directories for php files, then place those php files along with their path ($dir/$filename) into an array (to use elsewhere) So if I have the following file/directory structure (example): Code: [Select] --forums: ---topic.php ---forum.php --func: ---functions.php Would produce the following array: $files = array('topic.php' => 'forums/topic.php', 'forum.php' => 'forums/forum.php' 'functions.php' => 'func/functions.php'); Hello:
How could I use php to automatically insert the correct 3 letter month abbreviations and four digit year in the following pdf filenames on the first of each month?
(For example "...Feb2015.pdf" then "...Mar2015.pdf" and so on....
<div>Book One: <a href="http://monthlybookfi...One_Jan2015.pdf">Download Here</a></div> <div>Book Two: <a href="http://monthlybookfi...Two_Jan2015.pdf">Download Here</a></div> <div>Book Three: <a href="http://monthlybookfi...ree_Jan2015.pdf">Download Here</a> </div> <div>Book Four: <a href="http://monthlybookfi...our_Jan2015.pdf">Download Here</a> </div> Please advise, Eggie Hi all I hope I have come to the right place. My system reads files stored on a drive and lists them to users through plain HTML, I made it 11 years ago and have to refresh my memory. My problem is that filenames seem to come in different formats, to how to decode/encode them is an issue...
My users use Scandinavian letters (æøåäöüõ) and it seems like one filename is in one format and another in another format. There is no logic to what format the filenames comes it. All files are ok and downloads as they should, they just dont list well. Any idea how I can handle this issue?
I need to display multiple files that have a similar file name, but there are timestamps added to the filename once its been modified. What could I use in PHP to display all these files? Right now I use a $path variable that looks into a SQL table to build the path to the folder that the files reside in.. ELSEIF($Recordmyrow['Applicatio'] == "pdf file") { IF($securityvalue != "P"){$display = false;} IF(file_exists(substr($path, 5))){} ELSE{$column4 = "<A href='javascript:mbox();'>UNAVAILABLE</A>";} } So there is a file called file1.pdf then another one called file1.mmddyyyy.pdf My code shows file1.pdf but not file1.mmddyyyy.pdf Is there some kind of wildcard I can use to get it to show all the files if they exist? Hey Guys, I want to be able to upload a large amount of mp3's to a private area on our website and have a script that will scan the folder for all the filenames and then create a record in the db of all the filenames. It is to help with creating the playlist for my friends radio show. To manually insert all the filenames each month woudl be a nightmare! I have been messing with a partial script I found on the web, and it kind of does something but not what I want it to. heres the db id int(4) title varchar(250) mp3 varchar(250) sort int(4) visible int(1) added datetime heres the script i am trying to use: <? $listDir = array(); $dir = "./music"; if($handler = opendir($dir)) { while (($sub = readdir($handler)) !== FALSE) { if ($sub != "." && $sub != ".." && $sub != "Thumb.db") { if(is_file($dir."/".$sub)) { $listDir[] = $sub; }elseif(is_dir($dir."/".$sub)){ $listDir[$sub] = $this->ReadFolderDirectory($dir."/".$sub); } } } closedir($handler); } $db = mysql_connect("localhost","gfab_ml","xxxxxxx"); mysql_select_db("gfab_ml",$db); $colors=serialize($listDir); //takes the data from a post $sql="INSERT INTO ml_music (ID, title, added) VALUES('','$colors','')"; $result = mysql_query($sql) or die (mysql_error()); ?> it does insert the values into the db but what it does is creates 1 record and spits all the results in a really weird way like this. into the title field. a:18:{i:0;s:23:"14 Mr Magic Premier.mp3";i:1;s:23:"track1.mp3";i:2;s:15:"track2.jpg";i:3;s:15:"track3.fxp";i:4;s:12:"track4.mp3";i:5;s:7:"track5.mp3";i:6;s:7:"track6.jpg";i:7;s:7:"track7.mp3";i:8;s:12:"track8.mp3" Could anyone please help me to make it work? im a bit of a noob. but i do like to tinker! Hi guys. Just a quick PHP question. I have a script running that gets the files from a directory. There is then a switch function that decides what to do with the file, ie... if it is a PNG... DO THIS.. if it is a docx... DO THIS.. etc. And i want each file to be in a different cell on the table. The table can be longer wider than 5 columns (however it can be as high as it wants). I currently have this bit working... but instead of one item in each cell... it is displaying every item in each cell. Any ideas Chaps? Here is my code Many thanks in advance if you could possibly help.. echo "<table><tr>"; $count = count(glob("../../shared/files/*.*", GLOB_BRACE)); for($i=1; $i <= $count; $i++) { /// echo "<td>"; /// if ($handle = opendir('../../shared/files/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $break = pathinfo($file); $b = $break['extension']; switch (@$break[extension]) { case 'bmp' : echo 'A BMP<br>'; break; case 'png' : echo 'A PNG<br>'; break; case 'doc' : case 'docx' : echo 'A DOC OR DOCX<br>'; break; default: echo 'FILE NOT RECOGNISED<br>'; } } } closedir($handle); } /// echo "</td>"; /// if($i % 3 == 0) echo "</tr><tr>"; } echo "</tr></table>"; ?> Hi All I'm after some advice about how to write a parser to match many different naming formats of a tv episode, so the one thing we can rely on is that a episodes are inside a folder named after the show, for example "House MD\episode name. s1e07.mkv" so we know the show name, that part is easy, the bit I need to match is the season and episode number. The format of the file name can differ is so many ways, here are some examples: - S01E01 - s1e10 - S3e6 - 105 (for season 1, episode 5) - EP01 (usually there's one season in this case, but not 100% of the time) So as you can see there are a few variations, almost always the show name is in there too, and sometimes they contain resolution, so: House.MD S1E09 720p HD.mkv, there are many combinations but since we already know the show name it's not something I think we need to worry *too* much about. My question relations to how you would approach this? You can see from the examples above sometimes this would be hard to match and work out. My initial idea would be to have a class called 'tvmatcher', or something, which has match handlers, one match handler for each format we need match, a handler would be a class that extends tvmatcher and have the same method, like $handler->match($string); the first one to match would be the winner. This could be extended to sanity check the result and ensure that the season/ep actually exists. I really don't know how to go about this, the idea above is my best so far, so again my questions really a How would you approach this? Is there a pattern that would help? any other ideas about how this could be acheived? It's worth noting that I'd be using external APIs to get show information, but would be out of the scope of this library, but could help with said sanity checks. Cheers, Billy I have several lines of text formatted as such: Code: [Select] title text – some more text blah blah blah How do I delete everything after title text from every line ( the and ndash and after)? Thanks! I have an email form that I use to generate email messages to a club distribution list. I add the body of the message from a form that sends that message to a php script. The emails are a mix of html directly from the script as well as what is sent to the script from the web page form. Example: $mailmessage = '<html><body>header of message' . $MessageFromForm . 'footer of message </body></html>'; **where $MessageFromForm is requested from the form and is the body of the email message. The html header and footer of the message look fine, but the code that came from my html form does not work properly. That code replaces a ' with \', and the html tags do not work. I do have the following included in my headers: $headers = "MIME-Version: 1.0" . "\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\n"; Any ideas on what could cause this? for($i=1; $i<=$round; $i++){ print "<tr><td align='left' valign='top'><input type='text' name='number$i' maxlength='2' size='2' /></td>\n "; print "<td align='left' valign='top'><input type='text' name='score$i' maxlength='1' size='1' /></td>\n "; print "<td align='left' valign='top'><select name='team$i'>\n"; print "<option value='-'>-<option>\n"; print "<option value='Home'>Home<option>\n"; print "<option value='Away'>Away<option>\n"; print "</select></td></tr>"; }What I'm having trouble with is that for every option tag there is an empty option tag added. How do I get rid of those empty option tags? Thankful for any help. Hi there I followed this post http://www.phpfreaks.com/forums/index.php?topic=95426.0 to get a multi-column layout of search results. All's well but I seem to have an extra blank row at the bottom of the table. This is my code for the table Code: [Select] echo '<table width="800px" class="center" border="1">'; echo '<td>'; if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 3; while ($list = mysql_fetch_array($result)) { // make the variables easy to deal with extract($list); // open row if counter is zero if($i == 0) echo "<tr>"; echo '<td><a href="word.php?w=' . $list['word'] . '">' . $list['word'] . '</a></td>'; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } echo '</tr>'; echo '</table>'; Any ideas on how not to have it there? Thanks in advance. Hi i've recently moved hosting servers as I had severe lag issues with my shared hosting. Since i've brought a dedicated linux server with apache and php. Since the move i get extra chars with the following code Code: [Select] <?PHP define( "MESSAGE", "Testing Testing 123" ); if(isset($_GET['message'])) { die(MESSAGE); } ?> My application SHOULD receive back "Testing Testing 123" like it used to with my old shared hosting. Instead now it receives the following: Code: [Select] 2f Testing Testing 123 0 And i cannot figure this out for the life of me. I'm expecting something silly to be the cause but would appreciate some guidance on this. Thanks So I'm generating an XML response for Google Maps and this is how my method looks:
/* * Generate XML for google maps * @param results Database results array */ public function generate_xml(array $results) { // Start XML file, create parent node $dom = new DOMDocument("1.0"); $node = $dom->createElement("markers"); $parnode = $dom->appendChild($node); header("Content-type: text/xml"); /* * Iterate through the rows, adding XML nodes for each * Have to do it the ugly way so results aren't pulled twice * (xml and php can't be passed within same array because headers are changed) */ foreach ($results as $row){ $node = $dom->createElement("marker"); $newnode = $parnode->appendChild($node); $newnode->setAttribute('id', $row['id']); $newnode->setAttribute('logo', $row['logo']); $newnode->setAttribute("name", $row['name']); $newnode->setAttribute("address", $row['address']); $newnode->setAttribute('city', $row['city']); $newnode->setAttribute('state', $row['state']); $newnode->setAttribute('zip', $row['zip']); $newnode->setAttribute('phone', $row['phone']); $newnode->setAttribute('email', $row['email']); $newnode->setAttribute('web_link', $row['web_link']); $newnode->setAttribute("lat", $row['lat']); $newnode->setAttribute("lng", $row['lng']); $newnode->setAttribute("distance", $row['distance']); } return $dom->saveXML(); }However, I'm getting this error: This page contains the following errors: error on line 2 at column 1: Extra content at the end of the document Hello I was wondering if anyone could help me. I have bought a script that are encoded is something that i cant change or read, and i have ask the owner how to put a {user} at the end of every hyperlink so are going to a other site, but he said you need a external script to do that. So was wondering if anyone could help me. Im using a database where all the user are etc But If i go to google.com and login as Bobmartin I will be at google.com/home Then i click on a hyperlink inside google.com/home that will bring me to a other side Lets say the hyperlink (other site) is www.phpfreaks.com/profile/ So when i begining to redirect to www.phpfreaks.com/profile/ the script will add {user} from the database So at the end i will be redirect to www.phpfreaks.com/profile/Bobmartin The hyperlink is generated in a unique code so i cant just add {user} it must be a external script i need to use. So to say it fast I want to add /{user} for every hyperlink that is redirect to another site without add {user} direct to the hyperlink for example www.google.com/{user}, the hyperlink must me www.google.com Well i hope you guys understand this, im not the best person to explain things so Also my english suck so dont judge me Hi, thanks for reading this! I need some help with my pagination, maybe the answer is very simple but I've tried a lot of coding including work with tables but it didn't work It's about my page (in Dutch) where I show images of collections. A page looks like this: http://www.verzamelaars.net/mobach/index.php Now I want the name of the collector under the image, but every time I get this: http://www.verzamelaars.net/mobach/index2.php The code I use now is: <?php while($row = mysql_fetch_array($result)) { echo "<table><tr><td><a href='{$row['mijnlink']}'><img src={$row['thumb']} hspace=1 vspace=4></a></td></tr>"; echo "<tr><td><a href='{$row['verzamelaarlink']}'>{$row['verzamelaar']}</a></td></tr></table>"; } ?> I've been playing with the table but so far no good, hope you can help me with this! Kind regards, Arjen van Dorsten I am building a login script to help myself learn php. I currently have the script posting any registration form errors to the registration page. I am trying to make sure whatever the user has typed into the form will redisplay once they receive the error to prevent them from having to fill out the registration form again. I got it working, but there is an extra character "/" after what was entered by the user. Here is an example: Note: "1234" has been entered into username field on reg form. Code: [Select] <tr><td>Username: </td><td><input size="20" type="text" name="username" <?php if ($_POST){ echo "value =" . $_POST['username'] ;}?> /></td></tr> I get this output Code: [Select] 1234/ I do not know where the "/" is coming from. It should only be putting "1234" back into the username field. Any help would be great. Here is the issue: I am creating an input form which would allow someone to check multiple boxes. These checkboxes are populated from a table called reasonforcare. Here is my code: Quote <?php $rows = mysql_num_rows($reasonforcare); for ($i=0; $i < $rows; ++$i) { $row = mysql_fetch_row($reasonforcare); echo "<input name='reasonforcare' type='checkbox' value='" . $row[0] . "'/>"; echo $row[1]; } ?> I get all the checkboxes to show up, but at the end of the last database entry there is an extra checkbox! Can someone help me figure out why this is happening? |