Jump to content

whelpton

Members
  • Posts

    107
  • Joined

  • Last visited

Everything posted by whelpton

  1. Hi guys, I was wondering weather it would be possible to take the contents of a mysql table and insert it into a drop down form. My mysql table is called "Users" and I want to take the row "Username" and output it so that it displays all the current usernames in a form field such as: <select name="select" id="select"> <option>USERNAME1</option> <option>USERNAME2</option> </select> Obviously replacing the static username 1 and username 2 with the content from the mysql table
  2. Can you point me in the right direction please
  3. So there is no way of simply deleting the folder whilst it is full?
  4. Hello, I am trying to delete a number of folders using php, after searching the manual I have found the UNSET function, however when I use this it outputs the following error: Warning: unlink(/home/alport/public_html/test) [function.unlink]: Is a directory in /home/alport/public_html/shared/bandedit/delete.php on line 23 The folder is not empty, if that has anything to do with it. I was wondering where am I going wrong? The code I am using with the unlink function is: unlink("/home/alport/public_html/".$_SESSION['s_username']."");
  5. Yes it is, even after a few hours, the same content still appears
  6. The page itself refreshes, the content in the form does not. And I am certain that the content is changeing
  7. As an addon to a previous topic I started about echoing file contents in a text box. I am currently using the code: <input name="save" type="text" id="save" value="<?php include"/home/alport/public_html/".$_SESSION['s_username']."/text/name.txt" ?>" /> To display the contents of name.txt in a form field. When I submit the form, it changes whatever is in name.txt, but when I come back to the page the old content is still visable in the field. Ive tried using alt+f5 to refresh the page, but nothing seems to work. Is there a php method to ignore any cache and load the file afresh?
  8. Thanks for the secondary info, Ive just figured that out myself, just wondering... is there any difference between using get_file_contents and include? using include seems to be working fine.
  9. Im trying to echo a text file in my form using the following code: <label>Band Name <input name="save" type="text" id="save" value="<?php echo'/home/alport/public_html/".$_SESSION['s_username']."/text/name.txt'); ?>" /> </label> Ive used something similar before with sucess, but this time it gives me the following error: Parse error: syntax error, unexpected T_STRING in /home/alport/public_html/shared/bandedit/functions/bandname.php on line 5 Can anyone help me out please?
  10. Thanks for the replys everyone, I am using nl2br and I understand that line breaks dont mean anything to a web browser, the real problem is converting breaks into <Br> tags without having to type them into the form.
  11. well this is my page so far: http://www.alportstudios.co.uk/shared/profilecopy/ In the profile section, the text Default Profile test test test WOOOO Has been imputted from my form with multiple line breaks, and a <br> tag which has worked. Im using the nl2br function but it isnt working. When looking at my text file, the formatting is correct when viewed in notepad, but it isnt capturing any line breaks at all apart from the tag.
  12. Thanks, but it isnt being inserted into a DB its being inserted into a basic text file and when submitted it looses all of its formatting, so there isnt any "/r"'s or anything in the text file.
  13. I am currently trying to make an editable profile section using text files and updating form sections. The problem I am having is that the form does not recognise new lines properly. I allways have to enter <br> to create a new line. Is there anyway round this problem?
  14. I suppose I should have expanded a bit more, thanks for your advice on strip slashes, but how would I impliment it into this code? <?php $f = fopen("/home/alport/public_html/".$_SESSION['s_username']."/text/profile.txt", 'w'); fwrite($f, $_POST['save']); fclose($f); header('Location: home.php?action=change'); ?> or is it something that needs to be added at the form stage?
  15. Okay, im saving data into text files using php. Whenever I do it seems to add characters randomly. For instance: I\'m making an edit here. This is\'s just a test The slashes before the apohstrophe's are added by php. Is there any way round this?
  16. Hey everyone, my second post in a day here, im having some real problems. Ive been using a code to copy and recreate a folder on my server. The folder that is meant to be copied is setup with 777 permissions and is copied sucesfully to the new location, however, once it is copied, I cannot upload, edit, delete or move any files from the new folder, weather that be through cpanel or through ftp, It keeps on telling me that I dont have permission to do anything, even though its my server and the folder is set to 777. Any ideas whats going wrong?
  17. Thanks for the quick reply, Yes I do have session start at the top of my page and thanks for reminding me about semi-colons! Sometimes I feel like kicking myself for forgetting something so simple!
  18. Im trying to use the following function in conjunction with my session variables. Ive never been good at explaining what im trying to do so Ill post the code to explain. <?php $source ='/home/alport/public_html/shared/profilecopy'; $target = "/home/alport/public_html/".$_SESSION['s_username']."/" full_copy($source, $target) ?> Basically, I am trying to get $target to point to /home/alport/public_html/Logged In user ($_session['s_username']) then end with a trailing slash. Every code I try just gives me a T_Error. Can someone point out what Im doing wrong please?
  19. I am trying to create a file upon sucessful user registration. I've been trying to use the following code: $filename = 'test.txt'; $somecontent = "Add this to the file\n"; // Let's make sure the file exists and is writable first. if (is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($somecontent) to file ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } But I'm struggling with getting the correct file location. I'm trying to use the path /home/alport/public_html/, but then also include the persons username using a variable, for example by using $_POST["username"]. But I cant get the two codes to gel together. Id greatly appreciate pointers on how to get the code working. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.