Help with Voting System (PHP)

I am working on a voting system for my site, allowing users
to rate submissions.
On the submission page there is a voting meter (1-5) which is
actually five individual images side by side. Each one links the
user to the same page (index.php?page=submission&id=[id]) but
adds '&vote=[a number 1-5]' to the url. When the submission
page loads it checks if $_GET['vote'] is set and will take actions
accordingly. After these actions are taken I wanted to use the PHP
header function to reload the same page without the 'vote' variable
in the url, but I can't do this because the submission page is an
include on index.php, so it tells me the header has already been
set.
Obviously this method isn't going to work. Could someone tell
me a better way of doing this?

Q2) should the indexes be inserted before or after
inserting the document, or is this irrelevant?In the sense that this will not affect what the indexes contain, this is irrelevent. However, we normally recommend adding indexes before documents, or you would risk a lengthy re-index operation.
Q3) If I create the container from php as shown
before, and then I open it with dbxml it shows:
Type of default container: NodeContainer
Index Nodes: off
However if I create the container directly from dbxml
it
Type of default container: NodeContainer
Index Nodes: on
Why is that?This is a bug in the PHP API - it is also why your indexes made no difference for you. You will need to create your container outside PHP using DBXML_INDEX_NODES.
Q4) I need to repeat several times $mgr->query(....)
. Does this affect somehow the data base acces
performance?If the query is run several times, you would benefit from preparing it once, and executing it from the XmlQueryExpression object.
John

Similar Messages

  • Please, could you help with The System Error?

    Hi guys,
    Please could someone help me with The system error: The Parameter is incorrect? which appears on the screen when I open Adobe Photoshop?
    It is Starter edition3.0 and so far it worked ok and suddenly this message haunts my screen. If I clic OK, whole application disappears. I tried hundred times and checked it is 5.1.2600 and my notebook has got Windows XP Profesional.
    Any advice hunging around?
    ThaaankxJ

    Thank you mark, I'll try.
    J
    Date: Fri, 18 Mar 2011 17:17:20 -0600
    From: [email protected]
    To: [email protected]
    Subject: Please, could you help with The System Error?
    Hi orion,
    Sorry that was the impression made by the support agent. If the version of the software that you have is 3.0 or 3.2, then the catalog can be upgraded when you run the trial version of Photoshop Elements. Version 8 had no time limitations, not sure if version 9 will timeout after 30 days or not.
    Just install, and when you launch, Elements will automatically convert the catalog to a format that it can read.
    -Mark
    >

  • Need Urgent Help with Apache and PHP

    I have been struggling with apache and php for a week now and I finally broke down to post a message.
    I have apache 1.3 running on my mac mini g4 with 10.4.9 and I installed sql. I went to the entropy website and downloaded php5 to install without knowing I already had php4 on the machine. I installed 5 but could not get it to work. I then went back to httpd.conf and tried to install php4 by uncommenting out the loadmodule and addmodule lines. I restarted apache but php still did not work. I tested the phpinfo.php script but all I got was the script in Safari and not the actual page. At the moment, I have php4 and php5 on my machine but can't get either one to work. I am sure there is an easy fix but I don't know it. Please help.

    The problem is not terribly complicated, but Apache will not start with the entropy file in the folder
    /etc/httpd/users/
    Let me experiment on you. Rename the entropy file and then try to start Apache. To do this, open Terminal and paste this command:
    <pre>sudo mv /etc/httpd/users/+entropy.conf /etc/httpd/users/+entropy<pre>
    Now check the Apache configuration:
    <pre>apachectl configtest<pre>
    If it says "Syntax OK", start Apache:
    <pre>sudo apachectl start<pre>
    Since we only disabled the entropy file, you should be able to enable PHP5 with some more advanced configuring.

  • Help with automating "System Update"

    edit:
    please help - who do I contact in Lenovo / IBM to get real help with this ?
    this is a corporate project and I need to resolve this as soon as possible.
    does anyone from Lenovo actually read this forum?
    I've opend a support call in Lenovo's helpdesk (via email) but no reply except an automated one for... like a week.
    help! help! help! we don't mind paying for it, we NEED to resolve this.
    any help at all would be greatly appretiacted. please point me at the right direction?
    sorry for this venting but really, I just need to get a move on this already... :-0
    can anyone at all help ?
    any idea where I can find more information / expert assistance ?
    thanks for any help...
    -Shay
    Hi,
    I've been able to fully automate System Update distribution using Group Policy. this works perfectly.
    I am now trying to achive the same functionality using scritps.
    the problem: I get quite a few prompts for "License Agreement" - not the "master" initial one, only a few for the different installs.
    here's my setup:
    1. a local server is the repository.
    2. I import a .reg file before installing "System Update" using an automated install.
    3. after a restart, a command runs on the local machine.
    here are the details:
    registry settings:
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Lenovo\System Update]
    "LanguageOverride"="EN"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Lenovo\System Update\UserSettings\General]
    "IgnoreLocalLicense"="YES"
    "DisplayLicenseNotice"="NO"
    "DisplayLicenseNoticeSU"="NO"
    "ExtrasTab"="NO"
    "RepositoryLocation1"="***my internal server here ****"
    "RepositoryLocation2"=""
    "RepositoryLocation3"=""
    "NotifyInterval"="36000"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Lenovo\System Update\UserSettings\Scheduler]
    "SchedulerAbility"="YES"
    "SchedulerLock"="LOCK"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Lenovo\MND\TVSUAPPLICATION]
    *** network drive mapping here, this part works ***
    also, I use this command to run the updates:
    call "C:\Program Files\Lenovo\System Update\tvsu.exe" /CM -search A -action INSTALL -IncludeRebootPackages 1,3,4 -noicon
    I am just about desperate... I would REALLY REALLY appreciate any help, hint etc :-)
    Thanks for ...even trying... lol
    regards,
    Shay
    Message Edited by catman2u on 03-18-2008 05:04 AM
    Message Edited by catman2u on 03-25-2008 02:41 AM

    catman2u wrote:
    does anyone from Lenovo actually read this forum?
    From the Communiy Rules in the Welcome section....
     Objectives of Lenovo Discussion Forums
    These communities have been created to provide a high quality atmosphere in which users of Lenovo products and services may share experiences and expertise. While members from Lenovo may participate at intervals to engage in the discussions and offer advice and suggestions, this forum is not designed as a dedicated and staffed support channel. This is an informal and public forum, and Lenovo does not guarantee the accuracy of information and advice posted here -- see important Warranty information below.
    No amount of ranting is going to get you anything more than you will achieve with a clear exposition of your issue... so you might want to try doing that instead of ranting and assuming that everyone already knows what you know etc etc.
    Cheers,
    Bill
    I don't work for Lenovo

  • Help with IC systems

    Hi! Before I had a login on here I'd been lurking. I have made so much progress just by reading so much!
    Now the current issue I'm having is with IC systems. I have two unpaid collections being reported. Does anyone have an email contact they can send me for them? I'm trying to do a PFD.
    Thanks!

    Contact information is on the website. I was able to get 3 accounts deleted from my account through PFD. FYI they will not a letter stating that they will delete. However, after 30 days of paying all accounts were deleted

  • Sun would like your help with the "System Name Already In Use"  error

    A couple of users have reported getting an erroneous "System Name Already in Use" error when re-registering a system after a fresh Solaris re-install. We'd like your help in tracking down this problem.
    The scenario is this:
    * Install Solaris 10 and register with updatemanager,
    * Wipe out the installation and re-install Solaris.
    * re-register with updatemanager.
    The system erroneously reports that the system name is already in use. It is supposed to detect a duplicate registration of the same system.
    We have not been able to reproduce this error in our lab.
    If this has happened to you, would you let us know at [email protected]?
    Here are the things that we would like to ask of you:
    * If you run "updatemanager -debug" if will create a log file /tmp/basicreg<timestamp>.log.
    * Details on the exact hardware you have (make/model/configuration).
    * Details on the steps you took to get to the bad state. REALLY detailed!
    Thanks!
    Based on what we know now, we believe you can work around the issue by either:
    * Changing the host name and re-registering.
    * Creating a different user account and registering the host to that account.
    Some previously-posted workarounds are known NOT to work:
    * Wait 24 hours and try again.
    * Do some "ccr" incantations and try again.

    Hi,
    Can you drop me an email as i am a sun employee and i will be able to check if the swup frontline team have received any support cases on this issue and then we can work with you directly to resolve the issue.
    Scott Wallace

  • Help with indexing in PHP

    Hello,
    I use dbxml version 2.2.13 with PHP.
    I am trying to index a document but seems that without success because the performance doesn't change.
    The doc has 1600 elements and executing a query takes about 0.22 secs
    The xquery looks like this (a bit simplified):
    <pre>
    declare namespace ns1 = "urn:...";
    declare function local:foo ($p1 as element(), $p2 as element()) as item() {
    let $a := data($p2/AAA)
    let $b := data($p2/BBB)
    let $r := $p1//CCC/*[name()=\$a][@ns1:attr1=\$b]
    return $r/DDD
    local:foo( doc("...")/*[1] , ... )
    </pre>
    I create the container like this:
    $mgr->createContainer($qcname,DBXML_INDEX_NODES);
    I have 4 questions:
    Q1) Which index strategy should I take?
    I have tested using "CCC" , "node-element-presence-none" but no speed up occurs.
    The qplan shows sth like:
    <OQPlan>P(node-element-presence-none,=,CCC)</OQPlan>
    So seems the index is correctly set.
    It is strategy ok? Which other indexes should I use?
    Q2) should the indexes be inserted before or after inserting the document, or is this irrelevant?
    Q3) If I create the container from php as shown before, and then I open it with dbxml it shows:
    Type of default container: NodeContainer
    Index Nodes: off
    However if I create the container directly from dbxml it
    Type of default container: NodeContainer
    Index Nodes: on
    Why is that?
    Q4) I need to repeat several times $mgr->query(....) . Does this affect somehow the data base acces performance?
    I'd be glad if someone could help me to make the indexes work..
    Best,
    /Enric

    Q2) should the indexes be inserted before or after
    inserting the document, or is this irrelevant?In the sense that this will not affect what the indexes contain, this is irrelevent. However, we normally recommend adding indexes before documents, or you would risk a lengthy re-index operation.
    Q3) If I create the container from php as shown
    before, and then I open it with dbxml it shows:
    Type of default container: NodeContainer
    Index Nodes: off
    However if I create the container directly from dbxml
    it
    Type of default container: NodeContainer
    Index Nodes: on
    Why is that?This is a bug in the PHP API - it is also why your indexes made no difference for you. You will need to create your container outside PHP using DBXML_INDEX_NODES.
    Q4) I need to repeat several times $mgr->query(....)
    . Does this affect somehow the data base acces
    performance?If the query is run several times, you would benefit from preparing it once, and executing it from the XmlQueryExpression object.
    John

  • Need help with Inventory System

    I am trying to throw together a semi-elegant inventory
    viewing system for a web site I am creating. The current website is
    going to be scrapped and remade relatively soon, so I really just
    want a quick and dirty solution. As such, I have been using some
    spry with xml datasets. I happened upon an article
    here
    that clued me in to a particularly interesting method of presenting
    the data, so I am attempting a similar design, along with code from
    spry samples (lots of cut-n-paste unfortunately, which is probably
    a major reason why I have so many problems). Anyway, here is the
    relevant info:
    Right now I have folders for each category, with an xml file
    for each size category. I arranged it this way, because I was
    originally going to use straight html files for each size category
    and in each folder, obviously not very practical. I played around
    with the idea of putting all sizes into one file and letting some
    spry+xml magic sort it out, but since I can't even get this to work
    I haven't really tried it. If you experts would clue me in as to
    which version might be more efficient or if you have any other
    ideas please feel free to put me in my place.
    Before I go any further, my main problem is the third line of
    the first piece of code, I'm having trouble getting the dsStock xml
    to load properly. The original example I cited above was using
    Coldfusion, but I guesstimated that it wouldn't be a problem to
    just load some straight xml files. Before I go any further I would
    at least like to know if what I am attempting is possible.
    Code to load in data for menus, category selection, and
    actual inventory etc........
    quote:
    var dsCategories = new Spry.Data.XMLDataSet("diamond.xml",
    "diamonds/diamond");
    var dsSize = new Spry.Data.XMLDataSet("size.xml",
    "sizes/size");
    var dsStock = new
    Spry.Data.XMLDataSet("{dsCategories::@id}/{dsSize::name}.xml",
    "inventory/product");
    diamond.xml
    quote:
    <?xml version="1.0" encoding="utf-8"?>
    <diamonds>
    <diamond
    id="AS"><name>Asscher</name><img>../img/diamond/thumb/asscher_diamond_chicago.jpg</img></ diamond>
    <diamond
    id="CU"><name>Cushion</name><img>../img/diamond/thumb/cushion_diamond_chicago.jpg</img></ diamond>
    </diamonds>
    size.xml
    quote:
    <?xml version="1.0" encoding="utf-8"?>
    <sizes>
    <size><name>0.70-0.99</name></size>
    <size><name>1.00-1.49</name></size>
    </sizes>
    snip of some inventory
    quote:
    <?xml version="1.0" encoding="utf-8"?>
    <inventory>
    <product
    id="B801-508"><shape>Asscher</shape><weight>0.7</weight><color>G</color>
    <clarity>VVS2</clarity><depth>71.1</depth><table>61</table><flo>None
    </flo><polish>Excellent</polish>
    <symmetry>Very
    Good</symmetry><dim>4.97x4.77x3.39</dim><price>2592.1</price>
    </product>
    <product
    id="B800-125"><shape>Asscher</shape><weight>0.7</weight><color>G</color>
    <clarity>VS1</clarity><depth>68.2</depth><table>58</table><flo>None
    </flo><polish>Very Good</polish>
    <symmetry>Very
    Good</symmetry><dim>4.93x4.78x3.26</dim><price>2366.7</price>
    </product>
    </inventory>
    Here is the actual code in the site (this seems to work out
    alright). I haven't rewritten the actual inventory portion yet,
    since I can't really get it to load properly. If I can get the xml
    I know that I can get it on the page.
    quote:
    <ul spry:region="dsCategories"
    spry:repeatchildren="dsCategories">
    <li class="product" spry:selectgroup="1"
    spry:select="selected" spry:hover="hover"
    spry:setrow="dsCategories">{dsCategories::name}</li>
    </ul>
    <ul spry:region="dsSize" spry:repeatchildren="dsSize">
    <li class="product" spry:selectgroupd="2"
    spry:select="selected" spry:hover="hover"
    spry:setrow="dsSize">{dsSize::name}</li>
    </ul>
    Sorry for the long post, but thanks for taking the time to
    give it a read and see if you can help me out. I will be eternally
    grateful.

    Hi StevenMig,
    I'm not seeing anything obvious. Have you tried loading your
    XML files directly to see if there are errors in the XML? Is your
    server serving up XML files with a Content-Type of text/xml or
    application/xml?
    If you post a sample page, perhaps me or someone else on the
    forum can take a look?
    --== Kin ==--

  • New to MAC  -help with previous systems folder -this should be an easy one!

    My PowerBook G4 (running Leopard) recently crashed due to some corrupt files, per the Genius Bar. I got it up and running with the Leopard upgrade disc as they recommended. Everything went well and on the HD it created a "Previous Systems" folder and everything is in there... (old applications, documents, etc. ... Now what do I do?
    Do I just run the applications (iWork, MS Office, Adobe products, etc.) from that "Previous Systems" folder or should I drag and drop them to the new applications folder, or is it better to delete and reinstall all the programs again? And if I have already opened some of the applications from the Previous Systems" folder will this prevent me from moving them.
    I just want to clean up my laptop and keep it simple... What is the safe and easy thing to do?
    Thanks for all the help... this site is what influenced me to switch from PC to MAC !
    John

    Start with the description in http://docs.info.apple.com/article.html?artnum=301270
    Once you sort that out, see:
    Switching from Windows to Mac OS X,
    Basic Tutorials on using a Mac,
    MacFixIt Tutorials, and
    MacTips Learning Centre.
    Additionally, *Texas Mac Man* recommends:
    Quick Assist.
    Welcome to the Switch To A Mac Guides, and
    A guide for switching to a Mac.

  • Need a lot of help with Kinetic Systems 3988 LabView VIs.

    I have a Kinetic Systems 3988 CAMAC Crate Controller. I am using the KS3988 LabView 5.1 set of VIs to communicate with the device. I downloaded this set of VIs from the NI web site. I'm new to LabView, so I'm having great difficulty. Virtually all of my commands result in time outs. Has anyone made simple LabView applications using the KS3988 set of VIs? I could really use them.

    Hello,
    I was unable to find any helpful application development information on the NI website regarding the 3988 VIs, but I did a search on the Internet for "3988 LabVIEW" (without the quotes) and several webpages came up (some in German) for some companies that seemed to be using the 3988 VIs in their applications. I recommend you perform a web search for more information on resources that could help you with using these VIs.
    I hope this suggestion proves helpful. Have a pleasant day.
    Sincerely,
    Darren Nattinger
    Applications Engineer
    National Instruments
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • Help with Mac Dreamweaver PHP

    Well, I finally have PHP embedded within HTML working however the directory structure is totally confusing me.  I place files is /MAMP/htdocs and yet nothing works unless I add /MAMP/htdocs/htdocs and place the index and other php files ALSO in there.  I must open the ones in /MAP/htdocs and yet when I run them using my test server the files in /MAMP/htdocs/htdocs are the ones that are actually used.
    My configuration in SITES is
    Test Server
    local/network
    /Applciations/MAMP/
    http://localhost:8888/
    I would appreciate help understanding how to properly configure DreamWeaver SITE so that I can place all files in the MAMP/htdocs directory and eliminate the reducntant one.
    Thanks,
    Rick

    If you're using MAMP, your DW local site folder should be something like this:
    /Applications/MAMP/htdocs/sitename
    Because htdocs is the default folder MAMP routes to as localhost. Whatever site you have within htdocs folder will be suffixed with localhost in your browser for testing.
    For example, your site files (working files) can be put in a folder and that folder should be placed within 'htdocs' folder in MAMP Application folder.
    Say, you have a folder called 'test' containing index.php and this folder is placed within htdocs, your DW local site folder will be:
    /Applications/MAMP/htdocs/test
    To check this in browser, you'll simply enter
    http://localhost:8888/test
    This will run the index.php file within test folder by default.
    Your testing server can be the same as 'localhost:8888/test' for the site.
    If you want your Remote FTP also configured, enter your webhost's details and get that configured.
    -ST

  • Need help with control system that reduces a flat output signal every time a certain input exceeds given value

    I'm having difficulty setting up a closed loop control system that reduces one of my voltage outputs (connected to a high voltage system) by 30% every time a measured voltage exceeds a certain threshold value.  I'm using a USB 6229 DAQ.  I've been trying to create a waveform that looks like a DC signal, but the only waveforms that I can seem to manipulate while my VI is running are the stock waveform types.  Also, I've tried to use a formula node or conditional structure to update the output value every time the measured voltage exceeds a given value, but everything I do reinitializes the output value every time it runs or won't store the previous signal value.  I'm using LabVIEW 8.6 and don't have the PID or similar express VI's.  I've attached the mess I've got working right now.  Can anyone help?  I'm really stuck!
    Thanks! 
    Attachments:
    HiV step down.vi ‏40 KB
    output control.vi ‏100 KB

    I'm sorry it's such a mess; I'm still pretty new at this.  These are both little driver programs for a larger overall control program. 
    Output control is meant to send a flat signal to the DAQ whose value can be manipulated while the VI is running.  I have the second activated segment merely to check the values being output.  I didn't realize I attached a version with a meaningless control...I had a control where the user would put in the stating voltage (the high voltage source has a 1V-100V setting for external control).  I've attached this slightly different but equally dysfunctional version.  Ideally, I would have liked something like the analog signal generator vi to come with an input wiring for offset on the DC signal.  Most of the code was diabled because it is copied from an example; it is largely rubbish.  I initially used the DAQ Assistant, but when things weren't working out I switched to putting in each step manually to try to troubleshoot.
    As far as HiV step down is concerned, I've tried something different with a nested case structure (if that's the right terminology?), and I've attached that file.  I think this problem has been solved, but you never know!
    Attachments:
    output control slightly different.vi ‏100 KB
    HiV step down w case structures.vi ‏44 KB

  • Help with flash and php prlblem

    the problem is flash receive the data back after send
    loadvars.but it always got it wrong.
    code in flash is:
    send_btn.onRelease = function() {
    myVars = new LoadVars();
    myVars.username = username_txt.text;
    myVars.phonenum = phonenum_txt.text;
    myVars.picktime = picktime_txt.text;
    myVars.email = email_txt.text;
    myVars.address = address_txt.text;
    myVars.shortmessage = shortmessage_txt.text;
    myVars.onLoad = function(success) {
    if (success) {
    if (this.order) {
    gotoAndStop(2);
    } else {
    gotoAndStop(3);
    delete myVars;
    myVars.sendAndLoad("sendorder.php", myVars, "POST");
    and code in php is:
    $username = $_POST['username'];
    $phonenum = $_POST['phonenum'];
    $picktime= $_POST['picktime'];
    $email = $_POST['email'];
    $address = $_POST['address'];
    $shortmessage= $_POST['shortmessage'];
    $result=mysql_query("insert into
    userinfo(email,username,phonenum,address,picktime,message)
    values('$email','$username','$phonenum','$address','$picktime','$shortmessage')");
    if($result){
    echo "order=1";
    }else{
    echo "order=0";
    flash reponse after receiving the varaible from php is always
    go to frame 3
    but the test of php is output order=1.
    what is wrong with it?please help::^_^

    interesting b, but i think i see something else here that is
    the reason you needed to add the '&'. You're passing back a
    number value (ie. 0/1) and treating it as a boolean (all fine)
    except that in the echo statement it's all inside quotes, so it's
    being interpreted as a complete String. to remedy, try writing the
    echo like this:
    if($result) {
    echo('order='.1);
    }else{
    echo('order='.0);
    and you're welcome :)

  • Help With HttpURLConnection and PHP

    I can connect to a site with HttpURLConnection but i need to access a link FROM that site.
    Ex: www.hangman/index.php
    I need to get a link like www.hangman/index.php?letter=a
    It will only display the letter if you go from www.hangman/index.php and click on the letter. But how do i do that with HttpURLConnection.
    I think you have to use the POST , but it doesnt work.
    Thanks.

    That's probably because the site uses cookies to maintain a session.
    The cookie's name is PHPSESSID, so I'm guessing this is a standard PHP session maintenance system (I haven't worked with PHP much...).
    So if you want to create a java app that will play hangman from that site, it looks like you'll have to handle cookies to keep the session active between accesses. So you'll grab the cookie from the response headers in the first connection, and then send it to the server in the request headers in subsequent connections. The cookie may remain the same throughout the session, or it may change on each connection; I don't know.
    I did a quick google and found this:
    http://jcookie.sourceforge.net/
    I haven't used it myself, but it looks useful. Unless you're doing this as a learning exercise, it's probably easier to use this than to wrote your own cookie code.

  • Help with JS form, PHP Contact Form....

    I originally posted this in another area, but had no luck...
    I'm having trouble with a template that I downloaded (from Template Monster). My contact form shows "submitted", but I get no email.  I will submit my coding below & see if someone can help... My JS.forms is in a "JS" sub-folder in the main directory and my index.html and MailHandler.php/ashx files are in the main directory.
    MailHandler.php --
    <?php
        $owner_email = $_POST["owner_email"];
        $headers = 'From:' . $_POST["email"];
        $subject = 'A message from your site visitor ' . $_POST["name"];
        $messageBody = "";
        if($_POST['name']!='nope'){
            $messageBody .= '<p>Visitor: ' . $_POST["name"] . '</p>' . "\n";
            $messageBody .= '<br>' . "\n";
        if($_POST['email']!='nope'){
            $messageBody .= '<p>Email Address: ' . $_POST['email'] . '</p>' . "\n";
            $messageBody .= '<br>' . "\n";
        }else{
            $headers = '';
        if($_POST['state']!='nope'){       
            $messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "\n";
            $messageBody .= '<br>' . "\n";
        if($_POST['phone']!='nope'){       
            $messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n";
            $messageBody .= '<br>' . "\n";
        if($_POST['fax']!='nope'){       
            $messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n";
            $messageBody .= '<br>' . "\n";
        if($_POST['message']!='nope'){
            $messageBody .= '<p>Message: ' . $_POST['message'] . '</p>' . "\n";
        if($_POST["stripHTML"] == 'true'){
            $messageBody = strip_tags($messageBody);
        try{
            if(!mail($owner_email, $subject, $messageBody, $headers)){
                throw new Exception('mail failed');
            }else{
                echo 'mail sent';
        }catch(Exception $e){
            echo $e->getMessage() ."\n";
    ?>
    JS Form --
    //forms
    ;(function($){
        $.fn.forms=function(o){
            return this.each(function(){
                var th=$(this)
                    ,_=th.data('forms')||{
                        errorCl:'error',
                        emptyCl:'empty',
                        invalidCl:'invalid',
                        notRequiredCl:'notRequired',
                        successCl:'success',
                        successShow:'4000',
                        mailHandlerURL:'MailHandler.php',
                        ownerEmail:'I have Client's Email Here',
                        stripHTML:true,
                        smtpMailServer:'localhost',
                        targets:'input,textarea',
                        controls:'a[data-type=reset],a[data-type=submit]',
                        validate:true,
                        rx:{
                            ".name":{rx:/^[a-zA-Z'][a-zA-Z-' ]+[a-zA-Z']?$/,target:'input'},
                            ".state":{rx:/^[a-zA-Z'][a-zA-Z-' ]+[a-zA-Z']?$/,target:'input'},
                            ".email":{rx:/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@(( ?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1 [0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][ 0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i,target:'input'},
                            ".phone":{rx:/^\+?(\d[\d\-\+\(\) ]{5,}\d$)/,target:'input'},
                            ".fax":{rx:/^\+?(\d[\d\-\+\(\) ]{5,}\d$)/,target:'input'},
                            ".message":{rx:/.{20}/,target:'textarea'}
                        preFu:function(){
                            _.labels.each(function(){
                                var label=$(this),
                                    inp=$(_.targets,this),
                                    defVal=inp.val(),
                                    trueVal=(function(){
                                                var tmp=inp.is('input')?(tmp=label.html().match(/value=['"](.+?)['"].+/),!!tmp&&!!tmp[1]&&tmp [1]):inp.html()
                                                return defVal==''?defVal:tmp
                                trueVal!=defVal
                                    &&inp.val(defVal=trueVal||defVal)
                                label.data({defVal:defVal})                               
                                inp
                                    .bind('focus',function(){
                                        inp.val()==defVal
                                            &&(inp.val(''),_.hideEmptyFu(label),label.removeClass(_.invalidCl))
                                    .bind('blur',function(){
                                        _.validateFu(label)
                                        if(_.isEmpty(label))
                                            inp.val(defVal)
                                            ,_.hideErrorFu(label.removeClass(_.invalidCl))                                           
                                    .bind('keyup',function(){
                                        label.hasClass(_.invalidCl)
                                            &&_.validateFu(label)
                                label.find('.'+_.errorCl+',.'+_.emptyCl).css({display:'block'}).hide()
                            _.success=$('.'+_.successCl,_.form).hide()
                        isRequired:function(el){                           
                            return !el.hasClass(_.notRequiredCl)
                        isValid:function(el){                           
                            var ret=true
                            $.each(_.rx,function(k,d){
                                if(el.is(k))
                                    ret=d.rx.test(el.find(d.target).val())                                       
                            return ret                           
                        isEmpty:function(el){
                            var tmp
                            return (tmp=el.find(_.targets).val())==''||tmp==el.data('defVal')
                        validateFu:function(el){                           
                            el.each(function(){
                                var th=$(this)
                                    ,req=_.isRequired(th)
                                    ,empty=_.isEmpty(th)
                                    ,valid=_.isValid(th)                               
                                if(empty&&req)
                                    _.showEmptyFu(th.addClass(_.invalidCl))
                                else
                                    _.hideEmptyFu(th.removeClass(_.invalidCl))
                                if(!empty)
                                    if(valid)
                                        _.hideErrorFu(th.removeClass(_.invalidCl))
                                    else
                                        _.showErrorFu(th.addClass(_.invalidCl))                               
                        getValFromLabel:function(label){
                            var val=$('input,textarea',label).val()
                                ,defVal=label.data('defVal')                               
                            return label.length?val==defVal?'nope':val:'nope'
                        ,submitFu:function(){
                            _.validateFu(_.labels)                           
                            if(!_.form.has('.'+_.invalidCl).length)
                                $.ajax({
                                    type: "POST",
                                    url:_.mailHandlerURL,
                                    data:{
                                        name:_.getValFromLabel($('.name',_.form)),
                                        email:_.getValFromLabel($('.email',_.form)),
                                        phone:_.getValFromLabel($('.phone',_.form)),
                                        fax:_.getValFromLabel($('.fax',_.form)),
                                        state:_.getValFromLabel($('.state',_.form)),
                                        message:_.getValFromLabel($('.message',_.form)),
                                        owner_email:_.ownerEmail,
                                        stripHTML:_.stripHTML
                                    success: function(){
                                        _.showFu()
                        showFu:function(){
                            _.success.slideDown(function(){
                                setTimeout(function(){
                                    _.success.slideUp()
                                    _.form.trigger('reset')
                                },_.successShow)
                        controlsFu:function(){
                            $(_.controls,_.form).each(function(){
                                var th=$(this)
                                th
                                    .bind('click',function(){
                                        _.form.trigger(th.data('type'))
                                        return false
                        showErrorFu:function(label){
                            label.find('.'+_.errorCl).slideDown()
                        hideErrorFu:function(label){
                            label.find('.'+_.errorCl).slideUp()
                        showEmptyFu:function(label){
                            label.find('.'+_.emptyCl).slideDown()
                            _.hideErrorFu(label)
                        hideEmptyFu:function(label){
                            label.find('.'+_.emptyCl).slideUp()
                        init:function(){
                            _.form=_.me                       
                            _.labels=$('label',_.form)
                            _.preFu()
                            _.controlsFu()
                            _.form
                                .bind('submit',function(){
                                    if(_.validate)
                                        _.submitFu()
                                    else
                                        _.form[0].submit()
                                    return false
                                .bind('reset',function(){
                                    _.labels.removeClass(_.invalidCl)                                   
                                    _.labels.each(function(){
                                        var th=$(this)
                                        _.hideErrorFu(th)
                                        _.hideEmptyFu(th)
                            _.form.trigger('reset')
                _.me||_.init(_.me=th.data({forms:_}))
                typeof o=='object'
                    &&$.extend(_,o)
    })(jQuery)
    $(window).load(function() {   
        $('#ContactForm').forms({
            ownerEmail:'I Have Client's Email Here'
    Contact HTML --
    <form action="contact.php" method="post" id="ContactForm">
                                <div class="success"> Contact form submitted!<br>
                                  <strong>We will be in touch soon.</strong> </div>
                                <fieldset>
                                  <div class="wrapper">
                                    <span class="col1">Name:</span>
                                    <label class="name">
                                      <span class="bg"><input name="cf_name" type="text" class="input"></span>
                                      <span class="error">*This is not a valid name.</span> <span class="empty">*This field is required.</span>
                                      </label>
                                    </div>
                                  <div class="wrapper">
                                    <span class="col1">Email:</span>
                                    <label class="email">
                                      <span class="bg"><input name="cf_email" type="text" class="input"></span>
                                      <span class="error">*This is not a valid email address.</span> <span class="empty">*This field is required.</span>
                                      </label>
                                    </div>
                                  <div class="wrapper">
                                    <span class="col1">Phone:</span>
                                    <label class="phone">
                                      <span class="bg"><input name="cf_phone" type="text" class="input"></span>
                                      <span class="error">*This is not a valid phone number.</span> <span class="empty">*This field is required.</span>
                                      </label>
                                    </div>
                                  <div class="wrapper">
                                    <span class="col1">Message:</span>
                                    <label class="message">
                                      <span class="bg"><textarea name="cf_message" rows="1" cols="1"></textarea></span>
                                      <span class="error">*The message is too short.</span> <span class="empty">*This field is required.</span>
                                      </label>
                                    </div>
                                  <div class="btns"><a href="#" class="link1" data-type="submit">Send</a><a href="#" class="link1" data-type="reset">Clear</a></div>
                                  </fieldset>
                                </form>

    If Template Monster supplied you with this code, I think you should contact them about it.
    It's not how I would do things.
    Nancy O.

Maybe you are looking for

  • XI Installation: SAP System Account+Password- Login failed

    Hi All, This is my first attempt in installing XI. I have installed SAP Web AS 6.40 ABAP+Java System and am trying to install XI now. I can also confirm that my J2EE engine is up and running. I ran the J2EE example on HTTP using port 50000. Here is m

  • Snap Shot

    I took a snap shot of somthing so I can put it on my website (>Shfit>4) and it says its a png but how do I take out the white background so I can put it on any site?

  • Lightroom 4.3 VERY slow

    I dont think I'm alone with slowness using Lightroom 4. For what it's worth my story is I was using LR 2.6 and worked really well until I recently got a Canon 5D MkIII and needed to upgrade above LR2.x. LR4.3 is VERY sluggish compared to what I had -

  • 8.1.7.2.2

    How do I get from 8.1.7 to 8.1.7.2.2 for Solaris 8? Is there uprgrade available to downloaD?

  • Cisco's X2 10GE module and SDH STM64 (I-64.1) framing

    Which Cisco's X2 10GE module is compatible with STM64 I-64.1 interface on transmission equipment? It should be the X2-10GB-LR module, but Cisco's website does not say anything explicitly. For XFP modules, Cisco documentation state that they are compa