• Upcoming Articles

      0 comments

    I have had a few wild things that I have had to learn for a new site that I am working on so I will be writing a few new articles very soon.

    First is going to be on uploading Excel Spreadsheets to MySQL directly, not using PHP or ASP code to get this done.

    Other is going to be on making a search function for a website using MySQL and PHP. This one will be submitted to Dreamweaver directly because there is a huge mistake on their instructions on how to do this. I found 3 websites that pretty much gave directions on doing this exactly the same and all 3 forgot to include the most fundamental actions in the form that make the search work!

    I will put these up right before the new year as I have a few websites that I am working on right now.

  • PHP Form That Sends You An Email

      1 comment

    When making  a form on a website there are several options of where you want that information to go, either a database or to your email. This would be done with a site that you have a form that gathers information from a client who is requesting more information. For some time now I have been trying to work out how to have both actions, send the data to a database and to my email. This way I have captured the clients information in a database which I can then use to contact them at a later date. Having to go to my email helps me know who is trying to reach me about their website.

    Now I have it set up so that both can happen and here is the php code for it for the form:

    <?php
    } else {
    ?>
    <form action=”test.php” method=”post”>
    <table width=”400″ border=”0″ align=”center” cellspacing=”2″ cellpadding=”0″>
    <tr>
    <td width=”29%”>Your name:</td>
    <td width=”71%”><input name=”name” type=”text” id=”name” size=”32″></td>
    </tr>
    <tr>
    <td>Email address:</td>
    <td><input name=”email” type=”text” id=”email” size=”32″></td>
    </tr>
    <tr>
    <td>Comment:</td>
    <td><textarea name=”comment” cols=”45″ rows=”6″ id=”comment”></textarea></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td align=”left” valign=”top”><input type=”submit” name=”Submit” value=”Send”></td>
    </tr>
    </table>
    </form> ?>

    Here is the code for the email action:

    <?php
    if ($_POST["email"]<>”) {
    $ToEmail = ‘youremail@site.com’;
    $EmailSubject = ‘Site contact form ‘;
    $mailheader = “From: “.$_POST["email"].”\r\n”;
    $mailheader .= “Reply-To: “.$_POST["email"].”\r\n”;
    $mailheader .= “Content-type: text/html; charset=iso-8859-1\r\n”;
    $MESSAGE_BODY = “Name: “.$_POST["name"].”<br>”;
    $MESSAGE_BODY .= “Email: “.$_POST["email"].”<br>”;
    $MESSAGE_BODY .= “Comment: “.nl2br($_POST["comment"]).”<br>”;
    mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die (“Failure”);
    ?>}

    Couple of points that you need to pay close attention to in the email PHP code is that you need to fill in the $ToEmail variable so that it has your email address that you are sending it to. Also, make sure that the other variable’s strings throughout the form match the tables id’s. For example: $mailheader = “From: “.$_POST["email"].”\r\n”; the area $_POST["email"] is the id for the form which you will have to match with the database row. With my site I have it like this: $mailheader = “From: “.$_POST["txtEmail"].”\r\n”;. The txtEmail represents my row in the table for my database. So make you go through and match this up.

    Very, very important update! You will need to add this hidden field just below the submit but still in the <form></form> area “<input name=”email” type=”hidden” id=”admin@linkedupdesign.com” value=”email” />”. The email will not be sent unless you have this in there. This is the hidden field that tells the <?php?> to work!!  make sure that the value=”email” and the name=”email” stay the same because that is the global $_POST variable name.

    I have this email PHP code set up just about the form but not part of the <form></form>. Reason being is the form action is the recordset to post in to the databse so you don’t want to cross wires per say. These will be two separate action in the form.

    If you have any questions about this please feel free to get in touch with me.

  • Setting Up Testing Server Dreamweaver CS4

      5 comments

    dreamweaver_cs4_150x150

    On several occasions I have tried to set up to a database via Dreamweaver and I would get an error saying that Dreamweaver could not find a proper Testing Server. I have run in to this problem a few times now while working with Dreamweaver CS4 because I keep forgetting to write up what to do to handle it.

    I went on to the Dreamweaver help page and the only thing I can say is that engineers should not write instructions, bahh, if I was smart enough to understand what is said, I could write my own programs like Dreamweaver! I will take this up another day.

    Finally I remembered what I did in the past so here it is:

    This is what you would you would do only after you have set up the site and remote server:

    • SERVER MODEL: PHP MySQL
    • ACCESS: FTP
    • FTP HOST: ftp.site.com
    • HOST DIRECTOR: (leave blank)
    • LOGIN: login
    • PASSWORD: password
    • URL PREFIX: (this usually defaults to “http://ftp.site.com) change to “http://www.site.com”

    This last line is where I usually screw up by keeping the default setting where I then spend the next 100 hours trying to figure this out.

    Do take the note from Dreamweaver’s help page:

    Note: As of Dreamweaver CS4, Dreamweaver no longer installs ASP.NET or JSP server behaviors. If you’re working on ASP.NET or JSP pages, however, Dreamweaver will still support Live Mode, code coloring, and code hinting for those pages. You do not need to select ASP.NET or JSP in the Site Definition dialog box for any of these features to work.


SEO Powered by Platinum SEO from Techblissonline