Jump to content

foxhill

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

foxhill's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Okay, so if I explicitly name the array like you showed, will an unchecked box the a NULL value? Can I do something like: if $something[1] != NULL { echo $something[1]; };
  2. I am learning php, and I have a form with checkbox values. I need to create an array to hold these values, so I can later output them. How do I construct this? And then, how do I loop through the array in php to echo the values?
  3. That works exactly like what I wanted. I've never seen the array_slice() or implode() functions before, but they look like two I should become familiar with. This is awesome...Thanks!
  4. I am trying genericnumber1's solution, but I cannot get it to actually print anything. In the html, I have: <?php @include("includes/testimonials.php"); ?> When I removed the @ I did not have any errors, so I put it back in. I notice there is no echo statement, so I tried adding one. My html file is www.foxhilldesign.com/test.php and the script, obviously, is at www.foxhilldesign.com/includes/testimonials.php. What am I missing?
  5. I came across the following php code to display a random quote (that I have modified only slightly). How can I modify it to accept a variable to determine how many quotes to display without duplication? $quote[] = 'blah blah blah html code'; $quote[] = 'blah blah blah more html code'; $quote[] = 'blah blah blah some other html code'; srand ((double) microtime() * 1000000); $random_number = rand(0,count($quote)-1); echo ($quote[$random_number]);
  6. I am using the below (very simple) code to process a contact form. However, I cannot figure out how to have the email say it is from the user's email address. The address is entered in the form in a field called "email". What do I need to add to resolve this issue? <?PHP $to = "abc@def.com"; $subject = "xyz"; $headers = ""; $forward = 1; $location = "http://www.fghijk.com/"; $date = date ("l, F jS, Y"); $time = date ("h:i A"); $msg = "Below is your request confirmation. It was submitted on $date at $time.\n\n"; if ($_SERVER['REQUEST_METHOD'] == "POST") { foreach ($_POST as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; } } else { foreach ($_GET as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; } } mail($to, $subject, $msg, $headers); if ($forward == 1) { header ("Location:$location"); } else { echo "Thank you for subscribing to our newsletter. We will add you to our mailing list as soon as possible."; } ?>
×
×
  • 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.