Jump to content

cmgmyr

Members
  • Posts

    1,278
  • Joined

  • Last visited

    Never

Posts posted by cmgmyr

  1. With IE I know I can use this:[code]<!--[if IE]>
    <link rel="stylesheet" type="text/css" href="css/ie.css" />
    <![endif]-->[/code]

    Is there something like that for Safari where I can use a different style sheet, or is there some other hack?

    It is for a margin-top error if that helps. Everything looks fine in IE, FF, and Opera...just not Safari.

    Thanks
  2. The way that I do it is to slice my design up in photoshop, export it (with tables), then open it up in dreamweaver. Then I make a temp.html file where I work on the new CSS design. This way I can bounce back and forth between the table design and the CSS design and make sure everything is like how it is supposed to look. You still need to hand code all of the divs and information in the pages. There is really nothing that I know of that converts your table design to a css one...but I don't think you would want it anyways...

    I know I didn't give you too much information, but if you need to know anything more specific, please let me know. I usually "convert" 2-3 psd files a week for different clients.

    -Chris
  3. The good thing about php is that you CAN NOT see the source code in the browser. SO...

    [code]<?php

    $s = "Source";
    $c = "Code";

    echo $s." ".$c;

    ?>[/code]

    Will just be "Source Code" when you look at the "View Source" in browsers. Even if you download the script through a download program it will just show in the file what the browser would see. So they will never see the actual php code like above.

    Hope this helps,
    -Chris
  4. Hey Everyone,
    So I'm making a session shopping cart for one of my clients and I got it pretty much done but I ran into a few problems. If you go to http://kawellphotography.com/prints_main_categories.htm select a portfolio, then a picture and click "add to cart" you will see that this page gets added to the cart. Now, go back to that first page and add 2 (or more) different photos. So when you go back to the cart you should have 3 or more line items (all data is now correct). Now without changing anything in the shopping cart form click "Update Cart". You will now notice that I outputted a few lines to track the data. You can now see the values from the form, values of the session data before the update, and the values after the update. Notice that items 2 and 3 do NOT have the img_size variable in the session before the update, but then after the update the values are put in. BUT when you get down to the form area (where I printed out more information) you can see that just the second item doesn't have the img_size variable. Next, change the last item size to the opposite choice in the drop down and select "Update Cart" again. Doing this changes BOTH the 1st and the 3rd item, the 2nd item still doesn't have a size value. Lastly...go back to the portfolio choices and add another image to the cart (a totally new item). When you add it you will get an error of: Fatal error: [] operator not supported for strings in /var/www/html/cart.php on line 35. Line 35 is: $_SESSION["img_size"][] = 1;

    SO...I know it's probably simple (or maybe not) but I haven't worked with sessions much and I have no idea where to go from here. So I would greatly appriciate if I could get this solved as soon as possible. Please do not ask why I can't do this another way (like with a database) the customer wanted this done very cleanly without a database of any kind.

    I have included the full cart.php below.

    Thank you for your time,
    -Chris

    [code=php:0]<?php
    session_start();
    include "header.txt";

    switch($action){
    case 'add':

    if (!isset($_SESSION["items"]))
    {
    $_SESSION["items"] = array(); 
    $_SESSION["qty"] = array();
    $_SESSION["img_size"] = array();
    }

    $page = $_SERVER['HTTP_REFERER'];

    $page = str_replace('.htm', '', $page);
    $page = str_replace('www.', '', $page);
    $page = str_replace('http://', '', $page);
    //$page = str_replace('kawellphotography.com/', '', $page);
    $page = str_replace('localhost:8080/www/htdocs/kawell/', '', $page);
    $page = str_replace('prints_category_', '', $page);
    $page = str_replace('_', ' ', $page);

    $i=0;
            while ($i<count($_SESSION["items"]) && $_SESSION["items"][$i] != $page) $i++;
            if ($i < count($_SESSION["items"])) //increase current product's item quantity
            {
                $_SESSION["qty"][$i]++;
            }
            else //no such product in the cart - add it
            {
    $_SESSION["items"][] = $page;
                $_SESSION["qty"][] = 1;
    $_SESSION["img_size"][] = 1;
            }
    echo show_cart();
    break;

    case 'remove':
    $i = $_GET['remove'];
    unset($_SESSION["items"][$i]);
    unset($_SESSION["qty"][$i]);
    unset($_SESSION["img_size"][$i]);
    echo show_cart();
    break;

    case 'process':
    //see what the form wants to do
    $button = $_POST['button'];

    if($button == "Update Cart"){
    //loop through items
    $count_items = count($_SESSION["items"]);

    echo "<br />This does the update.<br />";

    $x = 0;
    while ($x < $count_items):
    $count = $_POST['count'.$x];
    $img_size = $_POST['img_size'.$x];

    echo "Info from form: Ses#: $x - img_size: $img_size - Count: $count<br />";
    echo "Info from session: Ses#: $x - img_size: ".$_SESSION["img_size"][$x]." - Count: ".$_SESSION["qty"][$x]."<br />";

    $_SESSION["qty"][$x] = $count;
    $_SESSION["img_size"][$x] = $img_size;

    echo "Info in session after update: Ses#: $x - img_size: ".$_SESSION["img_size"][$x]." - Count: ".$_SESSION["qty"][$x]."<br /><br />";

    $x++;
    endwhile;
    echo show_cart();
    }elseif($button == "Clear Cart"){
    unset($_SESSION["items"]);
        unset($_SESSION["qty"]);
    unset($_SESSION["img_size"]);
    session_destroy();
    echo show_cart();
    }else{
    //Complete checkout and clear
    $email = $_POST['email'];
    $youremail="XXXXXXXXXXX"; // This is the address that the information submitted will be sent to.
    $emailsubject="Order from KaWell Photography"; // This will the email's subject
    $from_who="$email";

    $name = $_POST['name'];
    $address = $_POST['address'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $zip = $_POST['zip'];
    $phone = $_POST['phone'];

    if ($email>"" && $name>"" && $phone>"") {

    $mailbody="Name:\n=================\n$name\n\n";
    $mailbody.="Email:\n=================\n$email\n\n";
    $mailbody.="Phone #:\n=================\n$phone\n\n";
    $mailbody.="Address:\n=================\n$address\n$city, $state $zip\n\n";

    $count_items = count($_SESSION["items"]);
    $x = 0;
    $grand_total = 0;
    $mailbody.= "Item - Size - Qty - Total\n";
    while ($x < $count_items):
    $mailbody.= $_SESSION["items"][$x]." - ";

    if($_SESSION["img_size"][$x] == 1){ $mailbody.= "16x20";}else{$mailbody.= "24x30";}

    //find total dollars
    if($_SESSION["img_size"][$x] == 1){
    $total = $_SESSION["qty"][$x] * 700;
    $grand_total += $total;
    }else{
    $total = $_SESSION["qty"][$x] * 900;
    $grand_total += $total;
    }

    $mailbody.= " - ".$_SESSION["qty"][$x]." - $$total\n";
    $x++;
    endwhile;
    $mailbody.= "\n\nGrand Total - $$grand_total\n";

    $pagebody="Name:\n<br />=================\n<br />$name\n\n<br /><br />";
    $pagebody.="Email:\n<br />=================\n<br />$email\n\n<br /><br />";
    $pagebody.="Phone #:\n<br />=================\n<br />$phone\n\n<br /><br />";
    $pagebody.="Address:\n<br />=================\n<br />$address\n<br />$city, $state $zip\n\n<br /><br />"; 

    $count_items = count($_SESSION["items"]);
    $x = 0;
    $grand_total = 0;
    $pagebody.= "<table>\n";
    $pagebody.= "<tr bgcolor=\"#CCCCCC\"><td>Item</td><td>Size</td><td>Qty</td><td>Total</td></tr>\n";
    while ($x < $count_items):
    $pagebody.= "<tr style=\"color:#FFFFFF;\">\n";
    $pagebody.= "<td>".$_SESSION["items"][$x]."</td><td>";

    if($_SESSION["img_size"][$x] == 1){ $pagebody.= "16x20";}else{$pagebody.= "24x30";}

    //find total dollars
    if($_SESSION["img_size"][$x] == 1){
    $total = $_SESSION["qty"][$x] * 700;
    $grand_total += $total;
    }else{
    $total = $_SESSION["qty"][$x] * 900;
    $grand_total += $total;
    }

    $pagebody.= "</td><td>".$_SESSION["qty"][$x]."</td><td>$$total</td>\n";

    $pagebody.= "</tr>\n";
    $x++;
    endwhile;
    $pagebody.= "<tr bgcolor=\"#CCCCCC\"><td></td><td></td><td>Grand Total</td><td>$$grand_total</td></tr>\n";
    $pagebody.= "</table>";

    mail("$youremail", "$emailsubject", "$mailbody", "From: $from_who");  // Send the email.

    echo "<br /><br />Please print the following form for you records.<br /><br />";

    echo $pagebody;

    //clear cart
    unset($_SESSION["items"]);
        unset($_SESSION["qty"]);
    unset($_SESSION["img_size"]);
    session_destroy();

    }else{
    echo "<br /><br /><div style=\"color:red;\">You have not filled something in correctly.</div><br /><br />";
    echo "<META HTTP-EQUIV=Refresh CONTENT=\"2; URL=cart.php\">";
    }
    }
    break;

    default:
    echo show_cart();
    break;
    }

    function show_cart(){

    $count_items = count($_SESSION["items"]);
    if($count_items == 0){
    echo "<br /><br />Your cart is empty.<br /><br />Please add something.";
    }else{
    $x = 0;
    $grand_total = 0;
    echo "<br />Show cart:<br />";
    echo "<form method=\"post\" action=\"cart.php\"><table>\n";
    echo "<tr bgcolor=\"#CCCCCC\"><td>Item</td><td>Size</td><td>Qty</td><td>Total</td><td>Delete</td></tr>\n";
    while ($x < $count_items):
    echo "<tr style=\"color:#FFFFFF;\">\n";
    echo "Information to use in form: Ses#: $x - img_size: ".$_SESSION["img_size"][$x]." - Count: ".$_SESSION["qty"][$x]."<br />\n";
    echo "<td>".$_SESSION["items"][$x]."</td><td>\n<select name=\"img_size$x\">\n";

    if($_SESSION["img_size"][$x] == 1){ echo "<option value=\"1\">16x20</option>\n<option value=\"2\">24x30</option>\n";}else{echo "<option value=\"2\">24x30</option>\n<option value=\"1\">16x20</option>\n";}

    //find total dollars
    if($_SESSION["img_size"][$x] == 1){
    $total = $_SESSION["qty"][$x] * 700;
    $grand_total += $total;
    }else{
    $total = $_SESSION["qty"][$x] * 900;
    $grand_total += $total;
    }

    echo "</select>\n<br />SES[\"img_size\"][$x] = ".$_SESSION["img_size"][$x]."</td><td><input type=\"text\" name=\"count$x\" size=\"5\" value=\"".$_SESSION["qty"][$x]."\"></td><td>$$total</td><td><a href=\"cart.php?action=remove&amp;remove=$x\"><img src=\"remove.jpg\" border=0 alt=\"Delete\"></a></td>\n";

    echo "</tr>\n";
    $x++;
    endwhile;
    echo "<tr bgcolor=\"#CCCCCC\"><td></td><td></td><td>Grand Total</td><td>$$grand_total</td><td></td></tr>\n";
    echo "<tr>
    <td colspan=\"4\">
    <input type=\"submit\" name=\"button\" value=\"Update Cart\">
    <input type=\"submit\" name=\"button\" value=\"Clear Cart\">
    </td>
    </tr>
    <tr>
    <td colspan=\"4\">
    <table border=\"0\" cellspacing=\"2\" cellpadding=\"4\" style=\"color:#FFFFFF;\">
    <tr>
    <td colspan=2><br /><br />To complete your order please fill out the following and click \"Complete Checkout\"</td>
    </tr>
    <tr>
    <td style=\"text-align:right;\">Name: </td>
    <td style=\"text-align:left;\"><input type=\"text\" name=\"name\" size=\"20\"> *</td>
    </tr>
    <tr>
    <td style=\"text-align:right;\">Phone #: </td>
    <td style=\"text-align:left;\"><input type=\"text\" name=\"phone\" size=\"20\"> *</td>
    </tr>
    <tr>
    <td style=\"text-align:right;\">E-Mail: </td>
    <td style=\"text-align:left;\"><input type=\"text\" name=\"email\" size=\"20\"> *</td>
    </tr>
    <tr>
    <td style=\"text-align:right;\">Address: </td>
    <td style=\"text-align:left;\"><input type=\"text\" name=\"address\" size=\"20\"></td>
    </tr>
    <tr>
    <td style=\"text-align:right;\">City: </td>
    <td style=\"text-align:left;\"><input type=\"text\" name=\"city\" size=\"20\"></td>
    </tr>
    <tr>
    <td style=\"text-align:right;\">State: </td>
    <td style=\"text-align:left;\"><input type=\"text\" name=\"state\" size=\"20\"></td>
    </tr>
    <tr>
    <td style=\"text-align:right;\">Zip: </td>
    <td style=\"text-align:left;\"><input type=\"text\" name=\"zip\" size=\"20\"></td>
    </tr>
    </table>
    </td>
    </tr>
    <td colspan=\"4\">
    <input type=\"submit\" value=\"Complete Checkout\">
    <input type=\"hidden\" name=\"action\" value=\"process\">
    </td>
    </tr>
    </table>
    </form><br /><br />";

    }

    }
    include "footer.txt";
    ?>[/code]
  5. a "." is for a class, you can use this as much as you want in one page

    a "#" is for an id, you can only use this once on each page

    <div id="wrapper">

    <div class="green">This is green text</div>
    <div class="green">This is green text</div>
    <div class="green">This is green text</div>

    </div>

    I didn't include the css...but I think you'll get the idea.

    -Chris
  6. Hey everyone,

    I want to do a few things, but I'm a little unsure about how to actually do it. I want to have a dynamic array of items holding multiple values: item_code, size, quantity then to store this into a session. Later I need to read each item from the session, maybe update it and/or delete an item out of the session. SO, where do I start and how would I do each of those functions.

    Thanks in advance,
    -Chris
  7. Try this out. You will need to add a few more things, but I think you'll get the idea...

    [code]<!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>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>CSS Forms</title>
    <style type="text/css">
    <!--

    body{
    background-color:#000000;
    }

    #form_wrapper{
    width:500px;
    }

    .left_form{
    width:50%;
    float:left;
    text-align:right;
    }

    .right_form{
    width:50%;
    float:left;
    text-align:left;
    }

    .left_hdr{
    color:#FFFFFF;
    font-weight:bold;
    font-size:12px;
    }

    .left_text{
    color:#999999;
    font-size:9px;
    }

    .clear{
    clear:both;
    }

    -->
    </style></head>

    <body>
    <form action="process.php" method="post">
    <div id="form_wrapper">

    <div class="left_form">
    <div class="left_hdr">Your Name</div><!-- End left_hdr-->
    <div class="left_text">Please enter your name</div><!-- End left_text-->
    </div><!-- End left_form-->
    <div class="right_form">
    <input name="name" type="text" />
    </div><!-- End right_form-->

    <div class="clear"></div><!-- End clear-->


    </div><!-- End form_wrapper-->
    </form>
    </body>
    </html>
    [/code]

    -Chris
  8. I'm in the midst of making a new site for my company. I did everything in CSS so far so that there is bearly any code for what you see. I am doing this for better SEO and readability.

    So far there is no content and there is only the index page uploaded to the site so all of the other links will give you an error.

    I will keep you posted on new additions.

    The link is http://syracusecs.com/v2

    Everything validates and I tested it in IE7, FF, Opera and I don't see any issues, please check it and let me know.

    Thanks,
    -Chris
  9. I didn't spend too much time on your site, but the first thing that I saw is that the overall size of your logo is too big and the white background of the image is going down into your gradient so it looks like there is a big chunk missing. If you make it a transparent gif, or crop it a little it should do the trick.

    -Chris
  10. Hey Everyone,

    I'm sure a few of you are having a problem with Dreamweaver 8 after installing Internet Explorer 7 with saving your site FTP information. If you go here: [url=http://www.adobe.com/cfusion/knowledgebase/index.cfm?event=view&id=KC.3491671c&extid=3491671c&dialogID=28498622&iterationID=2&sessionID=4830ee0d8ad03c7a3663&stateID=1+0+28530426&mode=simple]Adobe[/url] and download the Dreamweaver 8.0.2 Updater it will fix the problem...along with few other ones.

    I hope this helps some people...cause it was pissing me off for a few weeks.

    -Chris
×
×
  • 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.