Jump to content

sKunKbad

Members
  • Posts

    1,832
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by sKunKbad

  1. your ajax is trying to change a div named "updatediv", but none exists in the HTML
  2. have javascript make a cookie from the username, and php can check to see if the cookie exists. That is the only way I know to get a variable between the two languages.
  3. use javascript's split function and apply the changes to each div using the array made from the split.
  4. I figured it out. I changed the memory_limit setting in the php.ini.
  5. How do I change the settings of my WAMP to get rid of this: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 6291456 bytes) in C:\wamp\www\script_library\quiz\php5\final\quizxml.php on line 115 When I use this script on my customer's server it runs fine.
  6. This is what I am currently using, and it works: <?php $to = 'whatever72@yahoo.com'; $subject = 'Test HTML email'; //create a boundary string. It must be unique - so we use the MD5 algorithm to generate a random hash $random_hash = md5(date('r', time())); //define the headers we want passed. Note that they are separated with \r\n $headers = "From: Brian Evaslim <brian@evaslim.com>\r\nReply-To: brian@evaslim.com\r\nReturn-Path: brian@evaslim.com"; //add boundary string and mime type specification $headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; //define the body of the message. $message = " --PHP-alt-$random_hash Content-Type: text/plain; charset=\"iso-8859-1\" Content-Transfer-Encoding: 7bit Hello World!!! This is simple text email message. --PHP-alt-$random_hash Content-Type: text/html; charset=\"iso-8859-1\" Content-Transfer-Encoding: 7bit <h2>Hello World!</h2> <p>This is something with <b>HTML</b> formatting.</p> --PHP-alt-$random_hash-- "; $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent" : "Mail failed"; ?>
  7. OK, I guess I just need to use a email client that shows HTML. So I have to do it multipart. Thanks for your help.
  8. I've looked at a few tutorials on sending HTML email. All the tags show up in the email, and none of the HTML formatting is being applied. $email = "stinkbomb@yourhouse.com"; $content = "<p style='color:blue'This text should be blue</p>"; $header = "From: My Store <info@mystore.com>\r\n"; $header .= "Reply-To: info@mystore.com\r\n"; $header .= "Return-Path: info@mystore.com\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail ("$email","Look at my HTML email","$content","$header"); What am I doing wrong here?
  9. I suffer from road rage often, have followed and tried to fight people I save money like I'm broke, but spend it like I'm rich
  10. A solid css doesn't need hacks or alternative stylesheets. Instead of spending time directing browsers to the appropriate stylesheet, you should look into why your stylesheet isn't working for all browsers. The reason why I say this is that Safari is one of browsers that adheres more closely with so called web standards.
  11. It works fine in case anybody ever wants to know. I used a javascript detection in previous pages to make sure that PHP knows to either use the ajax type HTTPrequest or cURL script directly. As a side note, I couldn't find any javascript detection tutorials out there. What I ended up doing is setting a cookie with javascript, and then checking to see if it exists in php. If php sees the cookie set by javascript, it turns it into a session variable. When the user finally gets to the page that needs to know if javascript is enabled or not, php dishes out the correct code for the situation.
  12. http://www.sitepoint.com/print/advanced-email-php This has some really good info too.
  13. If I send an AJAX request to a php script as a page loads, and the user exits the page before the php script is done processing what it is doing, it should still do what it needs to do right? I've got a cURL script that adds users to a email database, but it runs slow (2 seconds) and I want to do it without the user seeing the lag. My plan would be to have the user see the "thank you" message while the cURL script is running in the background. I'm just concerned that if they see the thank you message and exit the page that the AJAX request would be interrupted.
  14. Thank you, that did work. Do you know where good documentation for this is located?
  15. I'm trying to send an email that has spaces in the from header: $header = "From: sKunKbad sKunKbad sKunKbad\r\n"; but when the mail comes through, there are periods between like this: sKunKbad.sKunKbad.sKunKbad What am I doing wrong?
  16. I saw a nice tutorial a while back on writing XML using a custom class. It wasn't php's simpleXML or DOM, but it looked easier and the site owner was offering assistance to anyone that needed help. You might search around the internet for "php XML class" and see what you find.
  17. OK, I see, thanks axiom82
  18. Why does this echo infinite 3s instead of 123: <?php $count = 3; for ($i = 1; $i = $count; $i++) { echo $i; } ?> I just want 123.
  19. I formatted the XML differently like you suggested, and parsed the data normally, and everything is working great. Thank you for your help. I tend to work too much (like 16 hours yesterday), and near the end I get so exhausted I get stupid. Here was my code in the end: The XML File: <?php $quizxml = <<<XML <?xml version='1.0' standalone='yes'?> <quiz> <questions> <question> <q>How many jelly beans can you eat?</q> <option> <choice>1</choice> <response>You must be skinny</response> </option> <option> <choice>10</choice> <response>You must be normal</response> </option> <option> <choice>100</choice> <response>You must be big like me</response> </option> </question> <question> <q>What is your favorite color?</q> <option> <choice>Black</choice> <response>I like that one too!</response> </option> <option> <choice>Pink</choice> <response>Oh... thats nice:P</response> </option> <option> <choice>Chartreuse</choice> <response>Maybe I don't like you anymore.</response> </option> </question> <question> <q>How do you feel right now?</q> <option> <choice>Great</choice> <response>I feel great too!</response> </option> <option> <choice>Sick</choice> <response>Maybe tomorrow you will feel better.</response> </option> <option> <choice>Depressed</choice> <response>I'm so sorry.</response> </option> </question> </questions> </quiz> XML; ?> The PHP: include 'quizxml.php'; $quiz = new SimpleXMLElement($quizxml); foreach ($quiz->questions->question as $question) { ++$count; $num = "Q$count"; $qnum = $_POST[$num]; echo "For question # $count, \"<em>" .$question->q. "</em>\", your answer was $qnum.<br />"; foreach ($question->option as $thisOption) { if ((string) $thisOption->choice == $qnum) { echo "<strong>$thisOption->response</strong><br />"; } } echo '<br />'; }
  20. What do you mean by normally?
  21. I've got a simple XML file: <?php $quizxml = <<<XML <?xml version='1.0' standalone='yes'?> <quiz> <questions> <question> <q>How many jelly beans can you eat?</q> <choice>1</choice> <response>You must be skinny</response> <choice>10</choice> <response>You must be normal</response> <choice>100</choice> <response>You must be big like me</response> </question> <question> <q>What is your favorite color?</q> <choice>Black</choice> <response>I like that one too!</response> <choice>Pink</choice> <response>Oh... thats nice:P</response> <choice>Chartreuse</choice> <response>Maybe I don't like you anymore.</response> </question> <question> <q>How do you feel right now?</q> <choice>Great</choice> <response>I feel great too!</response> <choice>Sick</choice> <response>Maybe tomorrow you will feel better.</response> <choice>Depressed</choice> <response>I'm so sorry.</response> </question> </questions> </quiz> XML; ?> and the goal is, when a post variable's value is determined to be a match, I need to echo the following response sibling. I'm trying to use the following script with no luck. It's really late here, so don't laugh to hard $quiz = new SimpleXMLElement($quizxml); foreach ($quiz->questions->question as $question) { ++$count; $num = "Q$count"; $qnum = $_POST[$num]; echo "For question # $count, \"<em>" .$question->q. "</em>\", your answer was $qnum.<br />"; for ( $y=0; $y = count($question->choice); $y++ ){ if ((string) $question->choice[$y] == $qnum) { echo $question->response[$y]; } } echo '<br />'; } Any suggestions?
  22. ok I figured it out on my own: ++$count; $num = "Q$count"; $qnum = $_POST[$num]; echo "For question # $count, \"<em>" .$question->q. "</em>\", your answer was $qnum.<br />";
  23. I need $count to be inside $_POST['Q$count'] as in the following, but its not working. ++$count; echo "For question # $count, \"<em>" .$question->q. "</em>\", your answer was {$_POST['Q$count']}.<br />"; I've tried a few different things, but can't get it done. What am I doing wrong here? Thanks.
  24. I've got a template that I made that allows to change the column position just by renaming the column ids in the html. It's a two column design.I like to change the pages around in my websites so they don't look so boring. Also, (not part of the reply to the quote), It took me a long time to fully grasp CSS positioning. The best way to learn is to just play with divs that have different background colors and border colors. The colors really teach you what is really going on.
  25. I ended up removing it altogether, making a second form that sends the stuff that needs to go to the checkout.
×
×
  • 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.