Jump to content

iconicCreator

Members
  • Posts

    84
  • Joined

  • Last visited

    Never

Everything posted by iconicCreator

  1. With the help of the great people in here and some reading, I have managed to come up with a PHP script that displays random images every time a page loads or when user refreshes the page/browser. The script also echos a caption according to time of day. Now I would like to modified the script so that instead of the image changing every time the page/browser refreshes, it will display a different image everyday with a caption. So the script will display a different image everyday with a caption. Now my current script displays images on reload/refresh with caption. Here is the script. <?php $images = array( array('file' => 'image1a', 'caption' => 'Good [PARTOFDAY]! <br /> My name is Rick. <br /> Welcome to B&I.'), array('file' => 'image2a', 'caption' => 'Good [PARTOFDAY]! <br /> My name is Dianna. <br /> Welcome to B&I.'), array('file' => 'image3a', 'caption' => 'Good [PARTOFDAY]! <br /> My name is David. <br /> Welcome to B&I.'), array('file' => 'image4a', 'caption' => 'Good [PARTOFDAY]! <br /> My name is Mariah. <br /> Welcome to B&I.'), array('file' => 'image5a', 'caption' => 'Good [PARTOFDAY]! <br /> My name is Gabriel. <br /> Thanks for visiting B&I.'), array('file' => 'image6a', 'caption' => "Good [PARTOFDAY]! <br /> I'm Morrison. <br /> Thanks for visiting B&I.<br /> How can I help you?"), array('file' => 'image7a', 'caption' => "Good [PARTOFDAY]! <br /> I'm Chris. <br /> Thanks for visiting B&I.<br /> Do you have a question?"), array('file' => 'image8a', 'caption' => "Good [PARTOFDAY]! <br /> I'm Carlos. <br /> Welcome to B&I.<br /> How can I help you?"), ); $i = rand(0, count($images)-1); $selectedImage = "../my_website_images/{$images[$i]['file']}.jpg"; $caption = $images[$i]['caption']; function PARTOFDAY($string) { $hour = date("H",time()); if($hour >= 6 && $hour < 12) $replace = 'morning'; elseif($hour >= 12 && $hour < 18) $replace = 'afternoon'; elseif($hour >= 18 && $hour < 24) $replace = 'evening'; else $replace = 'morning'; return str_replace("[PARTOFDAY]",$replace,$string); } ?> Any ideas will be greatly appreciated. Thanks everyone! IC
  2. Since this would be an instant quote, I would rather not have a database, meaning the user just enter what they want, not asking for name or contact information, just a quote. I say this based on my own web experience, when I go to a website and need a quote, I just want a quote not people asking me anything. IC
  3. Good Day everyone. I'm looking at creating a quote calculator, it will be like a form with questions about what the user wants to buy or quote and will give out a number in dollars based on what product the user selects from a drop down list. Example: What sandwich would you like to buy? (List Items) Price:(prices will be echo here). 1. Roast beef 2. Chicken 3. vegetable 4. Fish Now if the user selects Roast Beef, the price of the Roast Beef sandwich will be echo or printed. What would you like on your sandwich? (Check boxes must be use because user may need more then one condiment added.) 1. Ketchup 2. Cheese 3. Mustard 4. Lettuce Now if the user add ketchup, Cheese, ect, the price will add to the price of the sandwich and echo a total. Would you like a drink with your order? Again check boxes, user can select more then one drink, price added and totaled. 1. Diet Coke 2. Sprite 3. Root Beer 4. Mountain Dew. Also I need to be able to change the prices of each product in the script. The user does not see the price. The price only becomes visible when the item selected and added to the total. I would like to do this myself but novice to php, I have never done this kind of script befor and have been searching for tutorials and other resources but nothing close to this. Does anybody know where I can find an example, tutorials? Thanks everyone. IC
  4. Thank you very, very much for the resources! You have been very helpful. However, I am wondering if there is a link to the light box you mentioned. Thanks again. IC
  5. Here is another link, I'm not sure why it did not work, maybe it was modified. Try this and click on the game image. http://www.gamefly.com/game/xbox-360/FEAR-2-Project-Origin/130125/ I like the tool tip but that's not what I was talking about or looking for. IC
  6. I'm trying to add a pop up page to my website. To make it easy to understand, I have added a link from the website Game Fly. This is the link: http://www.gamefly.com/game/xbox-360...mmando/130180/ When you click on the link, click on the image of the game and you will see the pop up page. It is not a window. What I am looking for is a window or page just like what I mentioned above. With a close window button and I can basically add content to it. I am thinking it is Javascript. I turned off Javascript in the browser and I was amazed because instead of a dead site, a new page opens instead of the pop up page. How can I get this going? Any ideas? Resources? Thanks everyone. IC
  7. Thanks, I thought the same but don't know a lot of PHP, was thinking there was a way there. Have a wonderful day! IC
  8. Hello good people! I am sitting here wondering how can I dynamically add content to an HTML page using PHP so that the content is not visible when users view page source? Lets say I have a Nav Bar which contains a bunch of links that goes through out the site. Is there any method apart from include that I can use to add the Nav Bar to the html page but not make the Nav Bar visible when some view page source? I have been using include to help me break down my pages, script and separating content from actual layouts, the problem is you can still view the content in source. I'm just curious if there is such method, not that I would want to be hiding content which is not something I strongly care about but just curious. IC
  9. Hey there! Just wanted to get back to you on this. It works! Yeah! I had to do little changes in terms of making some corrections with the code you showed me, there were inconsistency with some of the naming. Eg: PARTOFDAY and PartOfDay, not the same. Anyway, it works perfectly! You've been a very great help! Have a very wonderful day! IC
  10. Hey thank you so much for the time and the effort! I have not worked with the code yet but I will try this and let you know how things come out. Your effort is all that counts and I really appreciate it! Thanks again - will get back to you! IC
  11. I have managed to create a script from reading and practicing, the script changes or display random images every time the page is reloaded or the browser is refreshed. The codes are in an include folder because I like to separate certain PHP script from HTML, this way I can have some stuff in separate places for easier trouble shooting. My question is or should I say, I need the caption that display along with the images to also display the time of the day. Example: Good morning Bob, if the person is visiting the page in the morning. Or Good afternoon Bob, if someone is visiting the page in the afternoon and so on. This is what I have so far. <?php $images = array( array('file' => 'image1', 'caption' => 'Good morning, <br /> my name is Rick, how may I help you?'), array('file' => 'image2', 'caption' => 'Good morning, <br /> my name is Dianna, how may I help you'), array('file' => 'image3', 'caption' => 'Good morning, <br /> my name is David, how may I help you'), array('file' => 'image4', 'caption' => 'Good morning, <br /> my name is Mary, how may I help you'), ); $i = rand(0, count($images)-1); $selectedImage = "images/{$images[$i]['file']}.png"; $caption = $images[$i]['caption']; ?> The script above is saved in an include folder. This is the HTML portion: <?php include('includes/random_image.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="assets/journey.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <img src="<?php echo $selectedImage; ?>" alt="Random image" /> <p class="caption"><?php echo $caption; ?></p> </body> </html> How do I get this going? Where do I start? What I want to do is new to me, I am still a novice! Any ideas or direction? Thanks everyone! IC
  12. Actually, I just inserted a break tag within the script and because this file is within an include folder, it can actually be display as a break within the html page. Thanks anyway, I really appreciate your time and efforts. IC
  13. I am practicing to have random images display on my page when the page is refresh or reloaded. This is just the part of the code I'm trying to add a line break to. <?php $images = array( array('file' => 'image1', 'caption' => 'Good morning, my name is Rick, how may I help you?'), array('file' => 'image2', 'caption' => 'Good morning, my name is Dianna, how may I help you'), array('file' => 'image3', 'caption' => 'Good morning, my name is David, how may I help you'), array('file' => 'image4', 'caption' => 'Good morning, my name is Mary, how may I help you'), ); $i = rand(0, count($images)-1); $selectedImage = "images/{$images[$i]['file']}.png"; $caption = $images[$i]['caption']; ?> I feel dumb asking this but I have tried and cannot get it to work with out trying to add an html line break in the html code. I need the return text to the browser to look like this. Good morning, My name is blah blah, how can I help you? Right now it's just all on one line. How can I add a line break in here? Thanks for your help! IC
  14. I have a form and the script on a separate page, however I am trying to put the validation code on the same page as the form script but it does not work. Being new to PHP I'm wondering if this is even possible? IC
  15. Got it, basically I placed the confirmation message in another page and added it to the action attribute. Thanks for you help! IC
  16. Hey thanks for the help, however, the confirmation message is wrapped in a div tag and so where do I insert this? Because since the div tags are XHTML, they show up in the form anyway. Just confused. It works when I have the script and the form in separate pages but then I do not know how to apply the validation with the form and the script being in separate pages. IC
  17. Okay, still taking baby steps with PHP, this forum has been an enormous help and resource and I wanna thank everyone! Now, I have created a form, the problem is I cannot get the confirmation message to appear after the user has submitted the form. This is the problem: When I put the PHP code and the validation message in a separate PHP page it works perfectly, the problem with this method is I do-not know how to add the validation when the form script is in a separate page. But when I add the script and the XHTML code on the same page, I can add the validation but the confirmation message appears when the form loads in the browser with the form - before the user has even submitted it. How can I add confirmation message to this form after the user has submitted it? Complete code without confirmation page. Any help or ideas will be appreciated. <?php $post = array("firstName" => "","lastName" => "","Email" => "","phoneNumber" => "","comments" => ""); $errors = $post; if (isset($_POST["send"])) { foreach ($post as $k => $v) $post[$k] = stripslashes($_POST[$k]); if (empty($post["firstName"])) $errors["firstName"] = "**Required!"; if (empty($post["last"])) $errors["lastName"] = "**Required!"; if (empty($post["email"])) $errors["Email"] = "**Required!"; else { if (!preg_match('/[^@]+@[^.]+(\.[^.]+)+/', $post["Email"])) { $errors["Email"] = "Invalid Email!"; } } 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!"; } } if (empty($post["comments"])) $errors["comments"] = "**Required!"; $error = false; foreach($errors as $k => $v) { if ($errors[$k] != "") $error = true; } if (!$error) { $address = "test@test.com"; $subject = "New Form Details Entered!"; $message = "You have recieved new information via your website form. The details entered are as follows:<br><br>"; $message .= "<b>First Name:</b> ".$post['first']."<br>"; $message .= "<b>Last Name:</b> ".$post['last']."<br>"; $message .= "<b>Email:</b> ".$post['email']."<br>"; $message .= "<b>Phone Number:</b> ".$post['phone']."<br>"; $message .= "<b>DOB:</b> ".$post['month']." ".$post['day']." ".$post['year']."<br><br>"; $message .= "<b>Like Colors:</b> ".$post['love']."<br>"; $message .= "<b>Favorite Colors:</b> ".$post['favorite']."<br><br>"; $message .= "<b>Favorite Genre:</b> ".$post['genre']."<br><br>"; $message .= "<b>Comments/Message:</b> ".$post['comments']."<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'].'<test@test.com>' . "\r\n"; mail($address, $subject, $message, $headers); } } ?> This the confirmation I tried to add but it's not working and appears in the browser when the page loads. <!--CONFIRMATION MESSAGE--> <?php $confirmation = "Thanks <span class=\"sendersName\">$firstName</span> for your message, we will contact within 24 hours."; ?> <div class="confirmation_message"> <?php echo $confirmation; ?> </div> <!--END CONFIRMATION MESSAGE-->
  18. I'm trying to add a word wrap function to this script but to only the comment variable which contained the text area. This is just a "dummy" practice script. Right now the word wrap applies to the entire mail rather then the comments area.. This is what I have. $address = "test@test.com"; $subject = "New Form Details Entered!"; $message = "<b>Web Message:</b><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><br> ".$_POST['comments']."<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'].'<test@test.com>' . "\r\n"; $message= wordwrap($message, 175, "<br />"); mail($address, $subject, $message, $headers); ?>
  19. I'm using session to indicate senders name on a form confirmation page. So if the user submits a page, the form is redirected to a confirmation page. The problem is if you don't manually clear the cookies and you send the page again, the old name still goes to the confirmation page even if you typed a new name. The idea of using the user first name on the page was to make it "more personal." Like Thanks BOB for your message: Is there a way around this? This is the confirmation page code: <?php session_start(); // at the top again ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Confirmation - Thanks for the feedback!</title> </head> <body> <div class="confirmation">Thanks <span class="sendersName"><?php echo isset($_SESSION['firstName']) ? $_SESSION['firstName'] : '' ?></span> for evaluating our product, we will contact you within 24 hours.</div> </div> </body> </html> And this code is in the form and Session start is at the top: $_SESSION['firstName'] = $firstName; header('Location: http://www.confirm.com/confirmation.php');
  20. Well it's working now. This is what I did. Attached the the image to the <div> tags in the footer.inc.php file. I placed the CSS file in the external CSS file and attached the external file to the head of the pages that contained the footer. The reason it wasn't working is because I was not pointing the footer style attribute to the right path for the image. The only problem is. I have to attached any html tags applied to the include files which has styling attached with the footer file. Lets say wanted to add the footer to the index page with a background. Instead of inserting this: <?php include('includes/footer.inc.php'); ?> I would have to add this: <div class="addBackground"> <?php include('includes/footer.inc.php'); ?> </div> This way the background image gets attached with the include footer. Thanks for all your efforts and time. IC
  21. This is the complete index page that contained the footer include file at the bottom Now The entire page is attached to an external style sheet. So I also placed the style/CSS for the footer include file into the external style sheet. It still doesn't work. Anyway, here's the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Japan Journey</title> <link href="journey.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <div id="header"> <h1>Japan Journey </h1> </div> <div id="wrapper"> <?php include('includes/menu.inc.php'); ?> <div id="maincontent"> <h1>A journey through Japan with PHP </h1> <p>Ut enim ad minim veniam, quis nostrud exercitation consectetur adipisicing elit. Velit esse cillum dolore ullamco laboris nisi in reprehenderit in voluptate. Mollit anim id est laborum. Sunt in culpa duis aute irure dolor excepteur sint occaecat.</p> <div id="pictureWrapper"><img src="testing_images/basin.jpg" alt="Water basin at Ryoanji temple" width="350" height="237" class="picBorder" /></div> <p>Eu fugiat nulla pariatur. Ut labore et dolore magna aliqua. Cupidatat non proident, quis nostrud exercitation ut enim ad minim veniam.</p> <p>Consectetur adipisicing elit, duis aute irure dolor. Lorem ipsum dolor sit amet, ut enim ad minim veniam, consectetur adipisicing elit. Duis aute irure dolor ut aliquip ex ea commodo consequat.</p> <p>Quis nostrud exercitation eu fugiat nulla pariatur. Ut labore et dolore magna aliqua. Sed do eiusmod tempor incididunt velit esse cillum dolore ullamco laboris nisi.</p> </div> <?php include('includes/footer.inc.php'); ?> </div> </body> </html>
  22. This is the include file with no graphic, just wrapped up in Html tags. <div> <p>© <?php ini_set('date.timezone', 'Europe/London'); $startYear = 2006; $thisYear = date('Y'); if ($startYear == $thisYear) { echo $startYear; } else { echo "{$startYear}-{$thisYear}"; } ?> Patrick Judson</p> </div> Now I added classes to the paragraph tag and the div tag and added the image with CSS. Like this: <style type="text/css"> .footer { background-image: url(../testing_images/footerImage.png); height: 40px; background-repeat: no-repeat; background-position: center bottom; width: 780px; background-color: #EDF5F7; } .copyright { margin: 0px; padding-top: 6px; padding-right: 0px; padding-bottom: 0px; padding-left: 20px; } </style> <div class="footer"> <p class="copyright">© <?php ini_set('date.timezone', 'Europe/London'); $startYear = 2006; $thisYear = date('Y'); if ($startYear == $thisYear) { echo $startYear; } else { echo "{$startYear}-{$thisYear}"; } ?> Patrick Judson</p> </div>
  23. I have been experimenting with PHP include files. I was also tried to add images to the include file. Eg. I created a footer and added a back ground image to the div tag holding the footer. Now when I add the include file to the index page, the "text" shows up but not the graphic. Just curious, if you can add a graphic and style with CSS, is this possible? Thanks everyone. IC
  24. How do I display the current date and time on a web page in this format: Tuesday, February 3, 2009, 11:25PM I know this will display the time on the server but will the time be live? Or is it going to change only when the user refreshed the browser? Thanks everyone!
×
×
  • 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.