Jump to content

xProteuSx

Members
  • Posts

    476
  • Joined

  • Last visited

Everything posted by xProteuSx

  1. I've got a PHP generated form which generates x amount of checkboxes, dependent on the number of values in an array. Hence, if there are three items in an array, three checkboxes are generated in the following manner: <form name="markform" method="post" action="somepage.html"> <input type="checkbox" name="marked[]" value="1" /> <input type="checkbox" name="marked[]" value="2" /> <input type="checkbox" name="marked[]" value="3" /> <img src="images/btn_check_all.png" onClick="checkAll()" /><br /> //check all boxes <img src="images/btn_uncheck_all.png" onClick="uncheckAll()" /><br /> //uncheck all boxes <input type="image" src="images/btn_update.png" /> //submit button </form> Now, if it wasn't for the fact that name="marked[]" is a javascript array, then my problem wouldn't be a problem. I could just do this: <SCRIPT LANGUAGE="JavaScript"> function checkAll() { var field = 'document.markform.marked'; for (i = 0; i < field.length; i++) field.checked = true ; } function uncheckAll() { var field = 'document.markform.marked'; for (i = 0; i < field.length; i++) field.checked = false ; } </script> However, this does not seem to work: var field = 'document.markform.marked[]'; How can I create 'Check All / Uncheck All' buttons when my input field name is an array?? Thanks.
  2. I know that its not exactly an answer to your question, but if you're willing ton consider an alternative: http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/
  3. Actually, you had it close: foreach($rows_details as $record_details) { echo "<td>" . $record_details['po_num'] . "</td> etc. } You might have to go by index number: foreach($rows_details as $record_details) { echo "<td>" . $record_details[0] . "</td> etc. }
  4. No, not quite, though I appreciate the help The problem with your code is that if $_POST['name'] == '', then I want $name = ''. Therefore, I want $name updated to the value of $_POST['name'], even if $_POST['name'] is an empty string.
  5. AyKay47, the IF clause should change the value of $name, therefore the value is dynamic. QuickOldCar, I would like the value to change, even if $_POST['name'] == ''. This is where I am having trouble. The clause works if I enter 'Dave' instead of 'Bob' but I want to be able to remove the value of name altogether, so that it is empty. Maybe I didn't explain it well the first time ... The first time that a user goes to the page there should be no $_POST values, right? Then, once they hit the submit button, the page refreshes, and the POST variables are created. I would like PHP to recognize when the form has been submitted and I want the value of $name to change, even to null or '' depending on the $_POST value. So if the $_POST value is empty, I want $name = '';
  6. It is hard to say what is going on without seeing more code. It looks like you are appending a directory to the current one. For example, you might be doing this: $dir = 'http://localhost/plaincart/admin/category/'; $dir .= 'product/'; That would generate http://localhost/plaincart/admin/category/product/; I don't really know anything about $_SERVER, to be fair. Maybe you should start like this: $root_dir = 'http://localhost/plaincart/admin/'; $category_dir = $root_dir . 'category/'; $product_dir = $root_dir . 'product/'; That way you would always be starting from one directory. Hope this helps ...
  7. I have something like this on one of my pages: $name = 'Bob'; if ((isset($_POST['name'])) || ($_POST['name'] == '')) { $name = $_POST['name']; //update database } echo '<form action='' method='POST'>'; echo '<table><tr><td width="125">Name: </td><td><input type="text" name="signature" style="width: 270px;" value="' . $name . '" /></td></tr></table>'; echo '</form>'; Here's the problem: Initially, because the form data has not been sent the input box says: 'Bob'. If I remove the name Bob from the input box by manually clicking in it and deleting the name, and I submit the form, it keeps showing 'Bob', whereas I would like it to be empty. What am I doing wrong?
  8. $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; ... that was the key.
  9. I've been using something like this to send email messages to users on a site: $to = $email; $subject = "Message From Microsoft.com\r\n"; $headers = "From: [email protected]\r\n"; $headers .= "Return-Path: [email protected]\r\n"; $headers .= "Reply-To: [email protected]\r\n"; $message = "<html><body><img src='http://www.Microsoft.com/images/logo.png' /><br /><br />You have a message from Bill:<br /><br />"; $message .= '<img src="' . $image . '" /><br /><br />'; $message .= 'Isn't it pretty?.<br /><br />'; $message .= '<a href="http://www.Microsoft.com">Microsoft.com</a></body></html>'; mail($to,$subject,$message,$headers); This sends, literally, text like this: <html><body><img src='http://www.Microsoft.com/images/logo.png' /><br /><br />You have a message from Bill:<br /><br /><img src="http://www.Microsoft.com/images/billiam.jpg" /><br /><br />Isn't it pretty?.<br /><br /><a href="http://www.Microsoft.com">Microsoft.com</a></body></html> Obviously, I would like the email to hide the HTML, but use it to format the output. Also, I'd obviously like the image to show up, not a link to the image, and I would like the link to show up as a link, not as HTML. How do I do this? Cheers.
  10. Got if figured out: $current_page = substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1); Its pretty simple after that ...
  11. I have a file that is included on all pages of a website. However, I don't want it included on certain pages. What I was looking for was something like this: if ($current_page == 'index.html') {} else {require_once ...} How can I do this? Cheers.
  12. Ofcourse, got it solved 15 seconds after putting up the post.
  13. I am trying to modify a header redirect similar to this: header("Location: index.html"); exit; I would like to do something like this: header("Location: index.html?user=' . $user . '"); exit; Ofcourse, this does not work. Any hints?
  14. Cheers, my friend. Good luck with the rest of your project!
  15. Got it! This is what I was originally trying: if ($d=$E->MediumImage) { $iu=$d->URL; $ih=$d->Height; $iw=$d->Width; if (!strlen($iu)) {echo "<center><a href='$url' target='_blank'><img src='images/amazon_noimage.jpg' width='175' height='175' border='0'></a></center><br />";} else {echo "<center><a href='$url' target='_blank'><img src='$iu' width='$iw' height='$ih' border='0'></a></center><br />";} $image = $iu; } What I should have been doing, and what works is: if ($d=$E->MediumImage) { $iu=$d->URL; $ih=$d->Height; $iw=$d->Width; echo "<center><a href='$url' target='_blank'><img src='$iu' width='$iw' height='$ih' border='0'></a></center><br />"; } else {echo "<center><a href='$url' target='_blank'><img src='images/amazon_noimage.jpg' width='175' height='175' border='0'></a></center><br />";}
  16. Returns nothing if $iu is empty. Doesn't even return a 0.
  17. Yeah, also doesn't work. I'm really baffled.
  18. I am working with the Amazon API, and I am trying to display a default image if a product does not have an image associated with it. The query is coming back as an array. Typically, each product image array looks like this: $d = SimpleXMLElement Object ( => http://ecx.images-amazon.com/images/I/51aUIul6XjL._SL160_.jpg [Height] => 160 [Width] => 112 ) The code goes like this: if ($d=$E->MediumImage) { $iu=$d->URL; $ih=$d->Height; $iw=$d->Width; echo count($d); if (strlen($iu) > 0) {echo "<center><a href='$url' target='_blank'><img src='images/amazon_noimage.jpg' width='175' height='175' border='0'></a></center>";} else {echo "<center><a href='$url' target='_blank'><img src='$iu' width='$iw' height='$ih' border='0'></a></center>";} } However, images/amazon_noimage.jpg never shows up (even though it is linked correctly, as I've tested this link). I have tried the following: if (strlen($iu) > 0) if (count($iu) > 0) if (strlen($d->URL) > 0) if (count($d->URL) > 0) if (isset($d)) if (!isset($d)) etc ... If I display the following, where there is no image, I get nothing displayed: echo $iu; print_r($iu); echo $d->URL; etc ... However, if there is an image, I get a link, such as the following: http://ecx.images-amazon.com/images/I/51c2BFpDN0L._SL160_.jpg There seems to be NOTHING that I can do to trigger the 'ELSE' part of the if statement. This is a total enigma to me ... any ideas??
  19. Thanks. I'm looking into FlowPlayer as an option, because I think that creating a movie in Flash may create compatibility issues such as with the iPhone. Supposedly FlowPlayer is compatible with everything. Thanks Thorpe.
  20. I am looking to embed an actual video, in flash format, into one of my sites. Embedding it is easy. However, I would like the video to have basic controls such as Play, Pause, Start from Beginning, etc. I don't want to upload the video to YouTube, then have it embedded on my site as a YouTube video. Is there an easy way to do this? Or a tool? I do have Flash CS5 ... Thanks. Cheers.
  21. ManicDan ... You got it brother! floridaflatlander: yeah, educational expense column. It was expensive.
  22. I am wondering whether there is a way to do a foreach loop for an array, without starting at index[0]. Say, for example, I wanted to start displaying the contents of a 20 item array starting at index 5, what is the best way to do it? I know of this way, but it seems too crude (ie. there has to be a better way): $count = 0; foreach($array as $item) { if ($count > 5) {echo $item;} $count++; } Any other ideas??
  23. Aguywithathing, I've studied your code, and tested it. The output it produces is this: LETTERS A B C D Not what I was going for ... Any other ideas?
  24. http://www.webhostingreviews.com/just-host-reviews.htm http://webhostinggeeks.com/user-reviews/justhost/ ... just to give you a couple of resources.
  25. Scootstah, I really don't know what your life experience has been, but I cringe at the lack of corporate accountability. Every since I have researched JustHost (which, admittedly, I should have been more thorough about before I paid for an account) I have discovered literally hundreds of in-depth reviews from past and present JustHost clients that have been having completely ridiculous and unnecessary problems. JustHost does NOT deliver on their guarantees, and they have cost me personally about 80+ hours of troubleshooting which turned out to be shortcomings on their end. Over the course of the year I have submitted 122 tickets related to problems that I should not have had and/or issues relating to disabled features and features that I am not given access to, but are generally standard. I will give you one drastic example: JustHost is the only hosting company I know of that does not allow a feature which displays your website downtime as part of the cPanel. They have been rude to me, without cause, and I've had to endure some bad attitudes from their end. Now they won't let me go! Do you understand what that means? My business is being sabotaged because my reseller account is being tampered with, and my clients are starting to question my professionalism. If we, as individuals, don't push for corporate accountability, who will? The government? God knows that corporations won't be doing it themselves. If you don't care to spend your time asking companies to comply by rules they have outlined, or asking them to delivered what they promised, then the least you could do is keep your comments to yourself about someone who is willing to donate their time to make the truth be known and either A, help people make a better choice or B, force the company to improve their services. Besides, you know what they say about opinions ... They are like assholes -- everyone has one, and everyone else's stinks. PS - Don't use words like 'slander' if you don't know what they mean.
×
×
  • 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.