Friday, May 30, 2008

The problem with free webhosting and clients

OK. PHP form magically started working again. This is both good and extremely mysterious...

I swear I haven't touch the code since yesterday (when it was working except wasn't sending emails). Yesterday I even tried it with the safe and tested code I was using the other day and it wasn't sending emails. Today - emails.

The reason it is mysterious: I sent off a message to the free site help desk ('My php form suddenly stopped working. I haven't changed the code. Is there a problem with your server?') and I actually got a reply this time! This is what they sent:
Hello,

No, we did not changed any server settings so the problem must be on your side.

Thank you,
www.000webhost.com

And - lo! By magic, the world is fine again. Perhaps my planets weren't in correct alignment. Mercury is in retrograde, and that's known to cause random electronic hiccups...

Anyway, client wants to meet to discuss the content in her site. ie what she should have on there. I should have just said 'no, I'm freaking busy at the moment, no time to sleep, little capacity to care re your site content' but I'm nice. Plus I am making her meet me at a coffee shop with my favourite coffee (Campos coffee. Its a lovely drop, even the most novice of barista usually manages to make a lovely cup of coffee out of it. Unless the coffee's been a bit over roasted. It did happen once. Toby's Estate is a close second. Can be touch and go - the better the barista, the better the coffee with that one. And it can get lovely. They have their 'warehouse' outlet cafe on City Rd, just off Broadway. You can get an awesome coffee there. Its not cheap, though.) But I digress....

Wednesday, May 28, 2008

PHP - yee haa!

Thanks to Daniel and Amber for all of their feedback over term. Thanks also to Amber for trying to sort out my PHP in class last night. But biggest thank you of all goes to Alastair for being so patient while we nutted out the php code for my form. It now works! Well, it refreshes the page, validates the email address and leaves a warning message if the email doesn't process properly, which is what I had been trying to make it do. Unfortunately all I ever see now is that error message. Even when i use the old code in the old form (the basic version). So all good re my project (except for tweaking the form layout to fit the warning messages and sorting out the IE/CSS issue). Except for solving the mystery as to why the PHP stopped working...might have to find another free web host....

Monday, May 26, 2008

Nobody loves me

In fact, I think Nobody is stalking me!!!
haha!!!

I obviously have the whole php email thing working fine from my site now. I've sent myself a heap of test emails, and they all say they are from 'nobody'. Small things amuse small minds...

So I got the whole css thing sorted out - thanks to Sarah (the aptly named) Champion and Linda from my Monday night class, who pointed out that php doesn't read css like html does... I'm torn between feeling like an idiot and feeling annoyed that this wasn't made clearer somewhere...like where were all he other ignoramuses on the web query sites asking the same questions? Actually, re the css problem, there were a couple of posts. This is the cure I used that sorted it all out:
http://www.webmasterworld.com/php/3243313.htm


Nifty trick...

And somehow the javascript is now working on my navigation buttons again. Its a bit slow (slower than the uni server) but it works!

Now, there are still a couple of things to do before this thing is actually properly ready for business. Firstly, i have to get the real content. I have to have a 'meeting' with my 'client' on Friday as she wants to chat about what she should write. Frankly, I don't care! I am like, put whatever the hell you want on this thing, once its done i never want to see it again! I'm obviously joking. Really. This being said I don't have the time to stop for freaking coffee meetings about things that won't actually affect my assignment marks at the moment. I am part thinking the whole real client thing was a bad idea. This being said, its good to have something to motivate me with its creation etc. Whatever.

Anyway, there are 2 things I need to sort out technically

1. the IE issue. But not before tomorrow

2. the form works, but it takes you to a confirmation page that is just a line of text saying 'email sent successful' or something. you need to back button to get back to the page you were on and then the email field is still filled in. I tried using javascript to verify the email address is a valid email address, and to clear the form but neither worked. i was going to play around with that tonight, but while i was looking for the css cure I stumbled upon this:

http://www.onlamp.com/pub/a/php/2004/04/22/php_css_forms.html?page=2

its a way to use php to verify the email and clear the field! Seeing as I'm using php anyway, I may as well give it a go...




Saturday, May 24, 2008

.........

So i changed the file extension to php and the file appeared, but the css and javascript won't work. At least now i know for sure my site looks fine if both of those are disabled.

I've been to the php and about sites re the php form, I thought, maybe with all of my fancy javascript attempts I've manged the basic html form. As far as I can tell, this is not the case, but its still freaking out about something. I've put the php in a separate file. I'll look at it again later. This is the link that works to the public site:
http://personaltrainer.web44.net/index.php

I've gone public...sort of...

Checked out the free web hosting at www.000webhost.com and it looked fine, even the domain name wasn't horrendous, so i signed up so I can start playing with the php part of the form that i wanted to do. Would be nice if the bloody site worked. Maybe they need time to scan the site to make sure its not dodgy. Anyway, I might check it again tomorrow, see if anything magically happens to it overnight...Than god it still works from the uni server or I would be freaking out right now...

So I've decided to leave the IE issue alone for now (planning to show it on Firefox to my team mates anyway on Tuesday), and I'm leaving the JS email validation alone now as well - I figure if I end up just sticking with the email sending the request from the user's computer for now, I shouldn't really be as worried re security/validation. I thought I may as well start on the php email generating thing instead. I think I may be starting to loose English. And no, I haven't been drinking (although I was supposed to be - in fact I was supposed to be out dancing tonight, and I LOVE dancing even more than drinking, but I have to work tomorrow, and I'm not talking homework. Bastards. Which means I also loose out on my Sunday coding session. I'm starting to enjoy those...)

This is where the site is supposed to be:
http://www.personaltrainer.web44.net/suesitehome.html

Wednesday, May 21, 2008

You wish you had red fingerless gloves, like mine...

Ok, the JS animated buttons seem to work (even though there's sometimes a short micro second delay while they load. I am using dial up. Shut up. Yes, dial up does still exist, and some of my client's clients might have it, so I like to think of it as a chance to do some real life in the field testing all by myself.)

As you can probably tell, I need to sleep. Before I go, the reason i am posting this was to make notes to myself. Just tried adding some JS validation script to my form. I got the whole thing in, and it validates, but doesn't actually work. Slight technical hitch...

Got the code from http://www.xs4all.nl/~sbpoley/webmatters/formval.html

Was also using this as a guide: http://www.elated.com/articles/form-validation-with-javascript/
as it seemed to have better step by step instructions than http://www.w3schools.com/js/js_form_validation.asp
which just gave you a bunch of script.

I chose to use the first link script as it gave a cool warning if your email address only had one letter after the @. I tried playing around with it, but i suspect I'm going to have to go back to the lecture notes or W3c schools tutorial on JS in order to do this successfully (yes, I admit I just started randomly changing the code, hoping I would instinctively be able to feel my way around a completely new language, now that I am in tune with my coding-self. This clearly completely failed. It appears you will still be able to call me Grasshopper for a while yet. Why, oh why wasn't i nicer to that JS coder in the bar the other week???)


*yawn*

Tuesday, May 20, 2008

Sometimes, its the simplest of solutions...

I'm unfortunately not talking about my IE issues solved, I'm talking about my JavaScript issues sorted - for now.

I checked out Alastair's suggestion re the CDATA 'hiding'/identifying code solution, but it wasn't the fix I was after. You see, I was trying to implement JS animation to trigger a mouseover jpg change for each of my navigation buttons. The problem with that was, the formula required me to use the name attribute to identify my images, and link them to the JS i needed to make this happen. The name attribute is fine - so long as you're using HTML 4.01 or XHTML transitional. Because I like a challenge, I planned to write my site in strict XHTML. I worked x-hard to make this so, and everything was wonderful and fine and valid, right up until now. I was weighing up the pros/cons re caving in on my principles and having the JS I wanted or sticking to my guns. As it turns out, I could do both!

I found one fix that sugested substituting 'id' for 'name'. It seemed to work (although who knows re IE). I then realised i had only found the code to make it work for one button on a page, no a whole navigation row. I tried to play with the code to make it work (and had a range of results from none working, to all changing when the mouse was anywhere near any button, to only one button changing no matter which button you hovered over). I decided to pass the question on to my brains trust (aka Google) and discovered some interesting information (http://www.programmingtalk.com/showthread.php?p=147625). I didn't even have to set the JS i the code - in fact I could ditch the start section altogether, as well as the id and name attributes! Just some simple inline script for each button. Voila! All functioning beautifully, fully compliant with W3c's strict XHTML and CSS rules! Yay!

Re the IE problem, Tim and I but borders around all of my divs at the end of class, and the page is looking a little less roomy.... I suspect IE is adding some padding somewhere (cheeky mongrels, as my mum likes to say), which is what is pushing the middle div down the page. As to why it's not reading my 'text decoration: none' request, it's anyones guess. But that's going to have to be one for another day. I don't have IE here at home and tomorrow I have a lot of Interaction Design work to catch up on!