Jump to content

ialsoagree

Members
  • Posts

    406
  • Joined

  • Last visited

Everything posted by ialsoagree

  1. Okay, I see the problem, change this: $path_of_uploaded_file[] = $upload_folder . $name_of_uploaded_file; To: $temp_path_of_uploaded_file = $upload_folder . $name_of_uploaded_file; Then change: if(!copy($tmp_name,$path_of_uploaded_file))//had to leave original because $value not yet set... { $errors .= '\n error while copying the uploaded file'; } To: if(!copy($tmp_name,$temp_path_of_uploaded_file))//had to leave original because $value not yet set... { $errors .= '\n error while copying the uploaded file'; } $path_of_uploaded_file[] = $temp_path_of_uploaded_file Sorry about that, let me know if that works.
  2. I've tried a million times to rewrite the code but I don't know what I'm doing wrong. Error is turned on (you can't see that in my above syntax). Thanks! If you haven't already figured it out, you need to close 1 of your parathensis: if (isset ($priceMods[$_POST['choose']]) { Should be: if (isset ($priceMods[$_POST['choose']])) {
  3. Can you post your updated code, there's been quite a few edits so lets make sure everything is in there correctly.
  4. Ahh, yes, you'll need to make a change here too: foreach ($path_of_uploaded_file as $value) { if(!copy($tmp_name,$value)) { $errors .= '\n error while copying uploaded file '; } } reset($path_of_uploaded_file); This will print errors for each uploaded file that couldn't be copied.
  5. I'm not quite sure what you mean by "remove the created array from the loop." If you make the two changes I listed above (save the path to the attachment to an array, and then use a loop to load each of the attachments to the e-mail using the array you made in the 1st change) you should be able to e-mail multiple attachments at the same time. Erm, one of my codes above is missing a semi-colon, must have hit delete 1 too many times. Correction is here: $path_of_uploaded_file[] = $upload_folder . $name_of_uploaded_file;
  6. I'm just attempting to be thorough. I don't have access to run his code atm. Regardless, you seem to have this, so I shall move along.
  7. No, not quite: echo 1 . 2; //prints the string "12" echo 1.2; //prints the number 1.2 Wow, okay, yes, you are correct. I was thinking of char and often mix up the two column size methods!
  8. These are only temporary passwords right? As rand and time are not good ways of generating passwords... Regardless, try: $passcode = rand() . time(); Also, if your database is limited to an int 11, realize you can only generate a random number between 0 and 9 to prefix it with, because time() will generate a number 10 digits long, leaving you with only 1 digit from rand, so you should probably call rand(0,9) or just increase the size of your column to at least int(15). You should also make sure you limit the length of the variable sent in the e-mail, since if it's longer it won't match your database.
  9. You're only getting 1 attachment because you're overwriting the 1st attachment. Inside your foreach loop where you check the attachments, you have this code: $path_of_uploaded_file = $upload_folder . $name_of_uploaded_file; That means, for the first attachment, $path_of_uploaded_file is set, and then the loop starts over for the second attachment. The second attachment overwrites the position of the first: $path_of_uploaded_file = $upload_folder . $name_of_uploaded_file; // this runs for the 2nd attachment, overwriting the path to the 1st attachment and thus you only get 1 attachment. One solution would be to use an array: $path_of_uploaded_file[] = $upload_folder . $name_of_uploaded_file Then use another foreach loop to attach the uploads: foreach ($path_of_uploaded_file as $value) { $message->addAttachment($value); }
  10. That's a perfectly fine decision! In my opinion, the if, elseif is the best route to take if you're going with a PHP solution. Let us know if you need any further help with that. Just to clarify, the javascript solution will still use CSS and HTML just like your page currently does, it simply handles the switching of styles on the client side rather than the server side, but your decision is fine. If you ever want to get started in Javascript, I highly recommend the W3Schools page for Javascript, it taught me basically everything I know about Javascript, it only takes about an hour to go through and try some of the examples, and Javascript is an immensely powerful tool for enhancing your webpages. When you get into AJAX, you can really see how powerful Javascript and PHP can be together. Best of luck to you!
  11. To use your words, "not even close." I never suggested such a thing, never even came close. CSS can't be used to change CSS, which is what I stated Javascript is used for. Read my statement again (emphasis added): Javascript is primarily used to change HTML and page styles on the fly (at least in the context of websites), which "enhance(s) the user experience with features/functionality that a static page cannot" - your statement literally agrees with mine, mine just explains how it does that. But an ENTIRE page call - which would be necessary if the page loads, then the user changes tyles - can require hundredths or even tenths of a second of server time. Not to mention, it takes even more user time to process the HTTP request, so you're wasting user time, and it creates an erroneous history entry in their browser. Using javascript takes the same time as the server request, but eliminates the HTTP request (well, perhaps not entirely if a new CSS file has to be loaded), eliminates all the server processing, and there's no erroneous history in the browser. Since this is a response to a misinterpretation of my position, I will acknowledge that I read it, but allow the rest of my statement to stand on it's own. @MargateSteve, whatever solution you want to choose is fine. There's nothing inherently wrong with manging style changes using PHP. I'm simply trying to provide you a more effective solution using Javascript. The javascript solution will be more stream lined for the end user, and require less processing for your server. It's a win/win. But it's not absolutely necessary. Sorry this thread has become so derailed.
  12. I guess it's a matter of opinion. But the primary purpose of Javascript is to be able to change HTML and styles on the fly, meaning it's primary purpose is exactly what the OP is looking to do. In my opinion, there's two major down sides to doing it server side: it's more work for the server, work that the client is entirely capable of doing on it's own. And two, it's less efficient for the end user. Instead of simply clicking a button and seeing the layout change, they now have to reload the page to get the new style, and they have to avoid their back button. IMHO, Javascript is the way to go when it comes to changing page layout. Even if 1 style only uses 5 elements, always calling 10 elements (incase the next 5 are needed) is more resource efficient than handling 2 requests, 1 for 10 elements and 1 for 5.
  13. Oh, I should have paid closer attention to the link, glad someone did!
  14. Yup, considered that after the post. Once again, can their be more than one occurance of something you'd search for? IE. can "Nashville" appear more than once? Is using a database possible? This is exactly the kind of work databases are meant for.
  15. Use explode: http://ua2.php.net/manual/en/function.explode.php Can more than one line match your criteria? IE. can there be more than one line that starts with "NASHVILLE"?
  16. In the same vane as what ChristianF wrote, it seems like you're making things harder for yourself than you have to. Why are you allowing them to have multiple selections, only make a few, and then you have to figure out which ones they made? Write your program so it's obvious which selections they did and did not make so that you don't have to write complicated logic to figure it out. In other words, if you they can submit color and size, but only submit color, then make the selection of size something you know is a non-selection, like the string "no selection". Then you'll always have 1 input for each option, and you can always know which options were and weren't chosen.
  17. Of the PHP solutions you listed, if/elseif/else would be the best route. You could make functions for the common elements if you didn't want to copy and paste large amounts of HTML. However, I think you'd be better off using javascript to be honest. What you're asking for doesn't really require any backend work at all, and javascript would give you the advantage of allowing the user to change the style without even needing to reload the page. Just have the javascript change the HTML of the page to fit the appropriate style, and then save their current selection in a cookie. When the page is first loading, it checks the cookie and makes any changes to the default it needs to. The disadvantage would be that anyone with javascript disabled wouldn't be able to do that, but you could always put a notice that the feature requires javascript to be turned on - and honestly, most users are browsing the internet with javascript on anyway.
  18. In the context of this discussion, I meant, when you're inside double quotes, you can only reference an array's index using a constant if you also have curly braces. I also left out the comment from my code that "something" will be the product of the echo.
  19. Just to add, you can only reference an index using a constant inside curly braces: <?php define('string', 'string'); $array['string'] = 'something'; echo "$array[string]"; ?>
  20. Posting "it won't work" doesn't tell me anything useful. I gave you another code to try, did you try it? Where is the echoed text that I asked you to provide? It's important that you post the code you're running. If you don't post the code you're running, how am I suppose to know you just posted something else? You need to take the time to provide me with useful information. You said it doesn't give you an error or anything - well surely it did something. You're the only one who can look to see what it might have done. If you come back and tell me it "doesn't work," all thats left for me to do is shrug my shoulders and wish you the best in figuring it out.
  21. Wait a second, in your reply to me you wrote this is your problem: $small_file = $image->createFile($filename); But in your original code you wrote it like this: $small_file = $image->createFile('small_'.$filename); $image->resize(100); $large_file = $image->createFile($filename); Obviously $small_file = $image->createFile($filename); isn't going to seem to work because $large_file = $image->createFile($filename); will just overwrite it. That's why you were doing $small_file = $image->createFile('small_'.$filename); in the first place.
  22. Don't forget to close the attribute tag for your href paramater - by the way, you don't need to concatenate variables to a double quote: echo "<td><a href='admin_decline.php?status=$row[leave_status]' onClick='return confirm('Are you sure to delete this news?')'>Decline</a> <a href='admin_approve.php?status=$row[leave_status]' onClick='return confirm('Are you sure to delete this news?')'>Approve</a></td>";
  23. Please run your script with this modification: function createFile($output_filename = null) { if($this->ext == "JPG" OR $this->ext == "JPEG") { echo "<br>imageJPEG( , $this->uploaddir . $output_filename , $this->quality );</br>"; } elseif($this->ext == "PNG") { echo "<br>imagePNG( , $this->uploaddir . $output_filename );</br>"; } elseif($this->ext == "GIF") { echo "<br>imageGIF( , $this->uploaddir . $output_filename );</br>"; } return $output_filename; } Copy the echoed line from your browser after running the code and post back here.
  24. Is there a problem with just adding the table rows into your current loop? echo '<table>'; while($row = mysql_fetch_array($query)){ echo '<tr>'; echo "<td align=\"center\"><h3><img src=\"". $row['Image'] ."\" alt=\"" . $row['First_Name'] . " " . $row['Last_Name'] . ", " . $row['Prefix'] . "\" width=\"100\" height=\"139\" class=\"docphotos\" /></h3>"; echo "<h3><a href=\"./doctors.php?action=bio&name=" . $row['Last_Name'] ."\">" . $row['First_Name'] . " " . $row['Last_Name'] . ", " . $row['Prefix'] . "</a></h3></td>"; echo '</tr>'; } echo '</table>';
  25. Why won't it work? Can you provide more detail?
×
×
  • 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.