Jump to content

iconicCreator

Members
  • Posts

    84
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

iconicCreator's Achievements

Member

Member (2/5)

0

Reputation

  1. So, you are saying you didn't take the 30 seconds to perform the one debugging step I proposed? Did you echo "$headers" to the page to validate it has the information you expect? Hi, just got around to doing that, I was not around a test environment. Also I am not sure I am doing this right but when I try to echo the header, I get the following error message. Notice: Undefined variable: headers in C:\active-projects\driven-factor\test-form.php on line 88 In a nutshell the header is not define. Basically what I did was manually fed the variables by assigning them values rather then through the form fields. Are we on the same page? IC
  2. I can change the name is the array but I am not sure that will solve the problem. I agree that is confusing. However, I am getting values under the indexes, what I mean is all the form fields are populating I am getting the values printed to the page. When I get an e-mail, it simply says the e-mail is from my e-mail address rather then the senders name. Thanks for your input. IC
  3. Good day, I searched the forum but cannot find a related post. I created this script, however, I can't seem to figure out how to get the senders name in the From area. Example: From: John Doe, which is the senders first and last name as entered on the form. I have tried adding that to the header but it does not work. Please Note: The script below is a working version. Here is my mail script: <?php session_start(); $_SESSION = array(); $post = array("firstName" => "","lastName" => "","email" => "","phoneNumber" => "","comment" => "","subscribe" => ""); $errors = $post; if (isset($_POST["submitBtn"])) { foreach ($post as $k => $v) $post[$k] = stripslashes($_POST[$k]); //VALIDATE FIRST NAME if (empty($post["firstName"])) $errors["firstName"] = "*Required"; else { if (!preg_match('([a-zA-Z])', $post['firstName'])) $errors["firstName"] = "*Invalid"; } //VALIDATE LAST NAME if (empty($post["lastName"])) $errors["lastName"] = "*Required"; else { if (!preg_match('([a-zA-Z])', $post['lastName'])) $errors["lastName"] = "*Invalid Name"; } //VALIDATE EMAIL if (empty($post["email"])) $errors["email"] = "*Required"; else { if (!preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$^", $post["email"])) $errors["email"] = "*Invalid Email"; } //VALIDATE PHONE NUMBER if (empty($post["phoneNumber"])) $errors["phoneNumber"] = "*Required"; else { if (!preg_match('/^[0-9]{3}-[0-9]{3}-[0-9]{4}$/', $post["phoneNumber"])) { $errors["phoneNumber"] = "*Invalid"; } } //VALIDATE MESSAGE OR COMMENTS if (empty($post["comment"])) $errors["comment"] = "*Required"; $error = false; foreach($errors as $k => $v) { if ($errors[$k] != "") $error = true; } if (!$error) { $address = "example@example.com"; $subject = "Example"; $message = "You have recieved new information via your website form. The details entered are as follows:<br><br>"; $message .= "<b>First Name:</b> ".$post['firstName']."<br>"; $message .= "<b>Last Name:</b> ".$post['lastName']."<br>"; $message .= "<b>Email:</b> ".$post['email']."<br>"; $message .= "<b>Phone Number:</b> ".$post['phoneNumber']."<br><br>"; $message .= "<b>Comments/Message:</b> ".$post['comment']."<br><br>"; $message .= "<b>Subcribed:</b> ".$post['subscribe']."<br><br>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: '.$post['firstName']." ".$post['lastName'].'<example@example.com>' . "\r\n"; mail($address, $subject, $message, $headers); $_SESSION['firstName'] = $firstName; header('Location: message-confirm.php'); exit; } } ?> Thanks! IC
  4. same link i posted...lol...just realized my sentence got all jumbled..weird Thank you, I think I had looked at that link before but I shall play around with it and see what happens. Thanks again.
  5. I am in a Central Time Zone, I was searching for a count down script that shows the number of days left to an event. I stumbled upon this script which uses several function to display the messages. However, the time is about an hour behind or at least not Central Time Zone. The time is the same on my local and remote servers, so I conclude it has to do with the script. I am not sure how to resolved this. Here it is: <?php class event{ var $today; var $eventDate; function event($d,$m,$y){ $this->eventDate = mktime(0,0,0,$m,$d,$y); $this->today = date("d-m-y"); } function daysLeft(){ $daysUntilEvent = date('z',$this->eventDate); $currentDay=date('z'); $daysRemain = $daysUntilEvent - $currentDay; return $daysRemain; } function eventOver(){ if($this->daysLeft() <=0 ){ return 'Next Event is July 10th.'; }else{ return 'Event Begins in <span class="daysToEvent">'.$this->daysLeft().'</span> Days!'; } } } $event = new event(24,06,2011); echo $event->eventOver(); ?> Thanks everyone! IC
  6. Hello, here is what I added to the code, however I did not add this in the original post because I did not want to post a coded causing errors. Basically I am getting a syntax error. <?php $images = array( array('file' => 'image1', 'caption' => 'Caption 1'), //Added for the link, error is on this line 'link' => '<a href="#">Read More</a>'), array('file' => 'image2', 'caption' => 'Caption 2'), 'link' => '<a href="#">Read More</a>'), ); $i = rand(0, count($images)-1); $selectedImage = "graphics/{$images[$i]['file']}.png"; $caption = $images[$i]['caption']; //Assigned the link to the random image $link = $images[$i]['link']; ?> Here is the output: <div id="stage"> <img src="<?php echo $selectedImage; ?>" alt="Random image" /> <p id="caption"><?php echo $caption; ?></p> <!--OUTPUT LINK HERE--> <p id="linktab1"><?php echo $link; ?></p> </div> Thanks again! IC
  7. Hello everyone, I have this very short script I wrote with help from a book using arrays and the rand function. Basically it changes the images randomly on browser load or refresh. However, I am trying to add an additional, not sure what to call it, a string or another caption for each images. Instead of this being a caption, it will be a link, so a link will appear under each caption that goes to another page when it is clicked on. I tried adding another caption and adding a like to it but getting syntax error. Thanks everyone! Here is the code: <?php $images = array( array('file' => 'image1', 'caption' => 'Caption 1'), array('file' => 'image2', 'caption' => 'Caption 2'), ); $i = rand(0, count($images)-1); $selectedImage = "graphics/{$images[$i]['file']}.png"; $caption = $images[$i]['caption']; ?> And here is where the images are written to the page: <div id="stage"> <img src="<?php echo $selectedImage; ?>" alt="Random image" /> <p id="caption"><?php echo $caption; ?></p> </div> IC
  8. This looks like what I need, thanks for the link I am looking at the possibilities as to how I can use this. Thanks again! IC
  9. Thank you very much for your time and effort! I know a bit of PHP so I can understand the codes a little. I seem to be understanding most except the somewhere variable. Will the somewhere variable contained the content that is written when the link is click? example: <?php $somewherevariable = "animal profile"; ?> Thanks again! IC
  10. Good day everyone! I know this is possible but I do not know how to do it. I have a single page, this page has no dynamic content. I have a set of links. What I need is to have content placed on the page based on the link the user clicks. Example: I have pictures of animals. When the user click a Zebra, the Zebra info is placed on the page. So the page does not change, meaning the content on the page changes but not the page it self. The idea is instead of creating different html pages for each animal profile, the profile is generated to the page from a php include file. Is is this possible? Can anyone, some one please point me to how I can get this going. Thanks everyone! IC
  11. Good Afternoon everyone! Hope all is going well. I have created a PHP script that changes images randomly with a caption for each image every time the browser is refreshed. I would like to modified this script so that the images change in sequence when the browser is refreshed. Lets say I have four images. The first image will be selected randomly and displayed. This will insure the user sees a different image every time they visit the page. The rest of the images will display in sequence based on how they are assign to the script when the page is revisited or refreshed. So if I had 50 images, the first image users will see will be selected randomly then the rest in sequence and the whole thing starts over when the browser is refresh or the page revisited. Here is what I already have but is currently random. <?php $images = array( array('file' => 'image1', 'caption' => 'A day at the beach'), array('file' => 'image2', 'caption' => 'Apples and Peaches'), array('file' => 'image3', 'caption' => 'A beautiful night'), array('file' => 'image4', 'caption' => 'Golden Harp')); $i = rand(0, count($images)-1); $selectedImage = "../my_images/{$images[$i]['file']}.jpg"; $caption = $images[$i]['caption']; ?> Images display in page where this is placed. <div id="random_image_display"> <img src="<?php echo $selectedImage; ?>" alt="Random Images" /> </div> <div id="caption_box"> <?php echo($caption); ?> </div> Thanks very much everyone! IC
  12. I'm just confused because I'm not trying to set cookies for a user name, it appears everything I read regarding cookies talks about getting user information for displaying. I just want the page to remember the text on the label so that it can remain when the page is refreshed. Thanks for the responds. IC
  13. I'm totally new to Javascript and really knows nothing. I have manage to create a Javascript style switcher with the help of many good people on this and other forum. This script causes the style sheets attached to my web page to change based on the user selection. When the user click a link or tab, the page changes styles. There are two style sheets, default and zoom. This is the function that process the style switching. var mystylesheets=["default", "zoom"] var cursheet=1 function rotateStyle(){ chooseStyle(mystylesheets[cursheet], 60) cursheet=(cursheet<mystylesheets.length-1)? cursheet+1 : 0 var obj = document.getElementById('mylink'); if(obj.innerHTML == 'default') obj.innerHTML = 'zoom'; else obj.innerHTML = 'default'; } Here is the link the user can click to switch style sheets. <a id="mylink" href="javascript:rotateStyle();">default</a> When this link is click, the style sheet changes. What this code also does is change the text or label on the link when the user click on it. So when the user click on the tab/link - the text changes to zoom or default. This helps the user know what style sheet they have selected. The problem is this. I need a way to make the text or label stay on the tab/link even when the page is refreshed. Because when the page is refreshed, the label/text changes to default, even if the user is viewing in the zoom mode. I need to know how I can set cookies for this. I have searched Google but found nothing I can understand. How do I set cookies so that the label stay on the tab even when the page is refreshed. Any help will be greatly appreciated. Thanks everyone. IC
  14. Thanks very much for you time, However, as I mentioned, the page does not contained a PHP variable, ad I'm just confused, Because it's running a javascript script. So how do I set a name? What will be a cookie/session be named? That's where I'm confused as to what will be the session name or cookie name, sine I have no PHP variable. IC
  15. I have a script, (Javascript) attached to my page. This script basically process a style sheet switcher that applies different style sheets to the page based on the users choice. This is my problem and I have tried all I know. I need the page to go back to the default style when the user closes the browser. How to do this? I have no idea! What I understand is that I have to find a way to remove/delete/distroy cookies when the user closes the browser. So that when they return, the page is back to normal style. Is it possible to use PHP to destroy/delete the cookies created by this script? Or are these cookies saved to my computer hardrive? If so, then how? Thanks everyone for your time a patience. IC
×
×
  • 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.