Jump to content

iconicCreator

Members
  • Posts

    84
  • Joined

  • Last visited

    Never

Everything posted by iconicCreator

  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
  16. Thanks so much adam, I have not had the chance to put all this together because I'm away from the computer but will try to shortly. I'm a total novice to Javascript but will try to figure things out. Thanks again, IC
  17. Thanks very much for the help and time. I have been wondering, lets say you have a button and the text on the button says normal and the when the button is clicked again, it says zoom. I'm talking about a label on the button. Not sure this is possible - but a way that the button can show which style sheet is activated. Thanks again, Patrick
  18. Hello everyone, Basically I have a button that calls a function, or the way I see it, it makes something happens. This button fires up an event that makes the page switch CSS style sheets. This is the buttons code: <input name="choice" type="button" value="style-sheet1" onClick="chooseStyle(this.value, 60);" /> ]<input name="choice" type="button" value="style-sheet2" onClick="chooseStyle(this.value, 60);" />[/ When I click this button, it pulls up the reference style sheet. Here's the problem: I must have more then one button to call up the different style sheets. I was thinking it would be nice to have one button that calls up the two style sheets. How can I add two events to one button? So if I click the button, it calls the first style sheet, if I press the same button again, it calls another style sheet. So making one button performs two events/function. I have no idea how to get this done. Any help or ideas will be greatly appreciated. Thanks everyone. IC
  19. Long story short, Send me a PM and I could build this for you. IC
  20. Thanks very much for the help, I'm not on the computer that contained the files that I'm working on for this project. However,I do have some questions. Will it be better to use session instead of cookie, since the user can turn cookies off? Also I see you have a duration in the code, 3600, do you need a duration for the style? With the button, the user can switch between styles. Just trying to learn this stuff. If you can share some light on this. Thanks again. IC
  21. I'm very sorry, I was away from the computer. Yes, I want to change the entire style sheet. I have two sets of style sheets in their own folders. Example: style_normal.css Example: style_zoom.css I want to assign a button on the page. The default style will be the style_normal.css, this is the style that will be on the page when user visit. And if they decide to zoom the page, they can click the button which will fire up the zoom style sheet. Thanks for all your valueble help, time and patience. IC
  22. I have two style sheets, one I'm going to call zoom.css and the other normal.css I need to have a php script that can process the switching. I also need a button that the user can click to initiate the switching. I have searched Google and there are many but being a novice, the problem is I don't know which is better or secure. Some of them lack additional explanation that will help a PHP novice use their script or example. There are also lots of conflicting posting in their comments/blog that just further confuses me. Does anyone know of any tutorials or resources that I can use to get this going? Thanks very much everyone! IC
  23. No. My question was applying CSS styling to individual images in the array. Since the array contains a collection of images being echo one at a time each day, I was asking how do I apply CSS to the images. Lets assumed I want Monday image to have a red border and tuesday image to have a green border. All I'm trying to do is apply individual style to the images. I did the following before posting my original question. <img src="<?php echo $aPictureOfTheDay[date('w')]['img']; ?>" class="cssHere" /> The problem is - this applied the same styling to all of the images when they are echo on a given day. Anyway, sorry for any confusion and thanks for your help. IC
  24. Thanks very much - so where do I applied the CSS styling to? I'm assuming the example above is to echo each image individually? IC
  25. With help, I have created a script that output/display a different image everyday. The problem is I would like to individual CSS styling to each image independently. I could add a CSS class to the out put bein echoed but the will apply to any image being display. Here is the complete code. <?php $aPictureOfTheDay = array( #Sunday array( 'img' => '/images/image.jpg', 'txt' => 'Today is Sunday.' ), #Monday array( 'img' => '/images/image.jpg', 'txt' => 'Today is Monday.' ), #Tuesday array( 'img' => '/images/image.jpg', 'txt' => 'Today is Tuesday.' ), #Wednesday array( 'img' => '/images/image.jpg', 'txt' => 'Today is Wednesday.' ) ) ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <div id="siteHeader"> <!-- Image of the day --> <img src="<?php echo $aPictureOfTheDay[date('w')]['img']; ?>" /> </div> <div id="siteFooter"> <!-- Message of the day --> <p><?php echo $aPictureOfTheDay[date('w')]['txt']; ?></p> </div> </body> </html> I have tried many methods but no luck. Can you echo each image independently, in order to apply individual styling? Thanks everyone. 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.