Jump to content

aleX_hill

Members
  • Posts

    143
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

aleX_hill's Achievements

Member

Member (2/5)

0

Reputation

  1. I guess I could use the same while loop to add files from the folder to the database and run as a conjob or similar... looks like I have some more work to do. Alex
  2. In that case, do you know any file uploaders that will put the files in a database? At the moment I FTP the images to a dir, and just read the files straight from the dir. Alex
  3. Can you suggest a way of doing this? I was thinking of using $_POST but I think that would need a javascript routine to pass the $_POST through to the phpThumb.php ? Thanks, Alex
  4. I dont know if anyone uses phpThumb, so I will explain the usage anyway. Usage: <img src=phpThumb.php?src=source.jpg&h=150> I am trying to hide my image url in the source, so I am trying to put the src into aa $_SESSION. In my while loop I have done this: $_SESSION['src'] = "path_to_file"; <img src="phpThumb.php?h=150"> and in the phpThumb.php file: $_GET['src'] = $_SESSION['src']; This works fine for the first image, but this image is repeated every time. I have tried putting a &rand=$rand on the end of the url in the <img> tag incase cache was the problem, to no avail. The session var is updated correctly, I am sure of that. Can someone tell me why phpThumb is not updating the image each time? Thanks, Alex
  5. Can someone point me in the direction of a script that will read the contents of a folder (they are all images) and then put them in a table, with pagination? I have a script that will read the files and put them in a table, but dont know how to start from half way through the folder on page 2 etc (without first making x readdir requests). <?php // Type in the full / absolute path to the folder... $path = $_SERVER[ 'DOCUMENT_ROOT' ] . "/clients/client1/"; // This opens the folder... $dir_handle = @opendir($path) or die("Unable to open $path"); ?> <table><tr> <?php $i = 0; // This loops through the files... while ($file = readdir($dir_handle)) { if($i == 4) { $i = 0; echo "</tr><tr>"; } if($file == "." || $file == ".." || $file == "index.php" ) continue; echo "<td><img src='client1/$file' height='400'></td>"; $i++; } ?> </tr></table> <?php // Close it... closedir($dir_handle); ?> Any help is greatly appreciated. Alex
  6. I had a couple of problems with the error reporting, especially the error[] = ... line. After omitting this it worked, with the exception of the use of document.forms[form]. The forms.[form] expects an integer, but seeing as my page has theoretically infinate forms, with a loop to create them, i simply added another argument for the form number, which is the same as the loop variable in my PHP script. Alex
  7. Tom, your a legend... I havent tested it yet, but it looks like that will do exactly what I'm looking for. Thanks for all your help, and be assure, if it doeant work, I will be back :) Alex
  8. That would be a way to do it. The biggest problem I have is that I am converting an old system, and would prefer not to have to change $_POST['var'] Also, I use the same function for many forms, but the javascript would have to be different for each form if I used that method. Thanks for the help, if you know of a way to do it without having a different function for each form, please let me know. Thanks, Alex
  9. Thats basically what I have... but when that page loads, there is no $_POST['id']; The form is as such [code] For each entry in db: <form action="" onsubmit="blockSubmit()"> <input type="hidden" id="id" name="hidden" value="<?php echo $id; ?>"> <input type="submit" ...> </form> [/code] I know my PHP code works fine (pretty much exactly as you said in the previous post) because when I loaded to page through <form action="page.php?action=delete_message"> it worked fine. Thats why I have posted here, because it is something to do with the AJAX that it doesnt work... Thanks again for the help Tom.
  10. That is pretty much correct. I want to pass ACTION to the script (ie. GetPage('ACTION')) and then have it go to page.php?act=ACTION . That bit is fine, works perfectly. The problem is that page.php looks similar to below. [code] switch($_GET['act']) { case 'ACTION':     mysql query to complete action (in this case delete message $_POST['id'])     tell the user that action is complete break; } [/code] I get "tell user action is complete", but it doesnt delete the message. $_POST['id'] is NULL. and I am sure that "id" is the correct name etc because it worked before I started using AJAX to make it quicker. Thanks for the help, I look forward to seeing a solution, its doing my head in... Cheers, Alex
  11. I ma using IE (the majority of the people using the system will use IE, so It has to work). I had fixed the page/response error, and everything goes well with the debugging. It will load the new page fine, just not pass through the variable. For example, I want to load page.pg?act=delete_message with the id of the message as post. It loads the page, and shows it (says "entry deleted"), but when i try to echo $_POST['id']; I get nothing. It seems like nothing wrong with the js as far as loading the page, just the passing of the variables. Alex
  12. I tried what was suggested, but it didnt seem to work. I made an error in my first bit of code, it is actually a GetPage('action') function, where it loads page.php?act=action. I cant see why this would create an error though. The new page loads fine when I use the code, but none of the $_POST variables are available. I tried changing the form to method="get" and using $_GET, but still no luck. If you know where I may have gone wrong, please let me know. On a side note, I have changed the following function: [code] function somethingelse() {   if (http.readyState == 4) {       var page = http.responseText;       //now we replace the your main div. I am going to assume that it is called main       document.getElementById('main').innerHTML = response;   } } [/code] so that it works (the example has var page, then sets the div to response), so that isnt the problem. Thanks again, Alex
  13. Thanks for the help. I will test later, and be back if I need any help.. Alex
  14. Can I just confirm that if i have a form as such: [code]<form action="javascript:GetPage()">[/code] where GetPage is a javascript function I am using for AJAX, I will need the code as shown before to actually submit the variables to the new page? Is there an easier way with the get method? Basically I have a main div, which holds all my content. I want to delete an entry in a db, so i am trying to post the id to the delete function page (which is loaded into the main div to show to error/confirm message). Thanks, Alex
×
×
  • 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.