Everything posted by MWP
-
Database to update multiple pages
OK. I'm getting there with this (I think) but have hit a wall. I've created my database and have written the php code to show it on a webpage. It works as required however I can't seem to style it. In the code below you'll notice that I have some paragraph tags in. That was just my experimenting as I can't seem to find a tutorial to explain what I need explaining although I'm sure this is more to do with me not using the right keywords! Anyway, my code is as follows; <?php $username="xxxxxx"; $password="xxxxxx"; $database="xxxxxxx"; $hostname="xxxxxx"; $link = mysql_connect($hostname, $username, $password); $db_selected = mysql_select_db($database, $link); $SQL = "SELECT * FROM security_companies WHERE london='TRUE' AND listing='SILVER' OR ukwide='TRUE' AND listing='SILVER'"; $result = mysql_query($SQL); while ($db_field = mysql_fetch_assoc($result)) { print "<p><a href=".$db_field['website'] . ">". $db_field['company'] . "</a></p><br>"; print "<p>" .$db_field['description'] . "</p><BR>"; } mysql_close($link); ?> Now, I want to add into the results a div class to style it but can't figure out where to put it. The look I want the result to have is shown here (You'll see the top listings have a blue background with a top border.) : http://www.uksecurit....uk/london.html When I put the div class around the whole php element it styles all the results with one seamless background, where as I need each individual result styled. I've tried adding a class to the paragraph tags for the second part of my code (not shown as that just displays a link) and it shows as an invalid syntax. If anyone has any ideas or ideally if anyone has a link to somewhere where I can learn this as I just can't seem to find the right place, it'd be much appreciated. Cheers.
- Database to update multiple pages
- Database to update multiple pages
-
Database to update multiple pages
T-G many thanks for your addition. I'm just starting to get to grips with MYSQL and PHPMyAdmin stuff now. The database for security companies is literally a directory for resources. The only information I will hold is information that the companies have given permission to be displayed so there's not too much of a problem with security, but your recommendation is definitely something I will keep in mind. I do have another query though that I was going to start a new thread for but will see if you guys can help in here. Basically the information I will be holding for each company will be the company name, email, services offered and locations covered plus a description of that company. Currently all my information is held on a spread sheet. I have the first column set up for the company name then 1 column for each service and location then I have just simply placed an x in each column alongside the company name (like a check box) to denote what services and locations are covered (see diagram below). I can't seem to add a picture but I'm sure you get what I mean. Anyway the question is. Can I create fields in my SQL database that will contain multiple bits of information or do I need to have one piece of info per field. So for instance can I label a field services, input the relevant services each one separated by a character? So for example the services field would contain the information security guarding, door supervisors, close protection. Is that possible for the php to then distinguish between the different sets of information contained in that one field, or do I need an individual field for each individual service? The end result I want is to have a drop down search feature so that my users can select a security service, followed by the required UK location (i.e door supervisors , London) then when they hit search all the companies that match the search selections are displayed. Hopefully that all makes sense?! Edit: T-G I've just looked closer at your code you provided and it looks like you've based it on one having a field labelled 'region'. Then selected all the companies showing London in that field to be selected. Could also have Scotland, and other regions in that same field under the header 'region' or would it all be treated as the same information? Some of the larger companies that use my site cover most of the UK and multiple services. I'd need about 23 fields just for the services and locations if it's not possible?
- Database to update multiple pages
-
Database to update multiple pages
Guy's. I currently have a website and I need to streamline the current method I have for updating it. The website is a security directory http://www.uksecurity-directory.co.uk and I have companies listed for services and locations. What I'm doing at the moment is I have a page for each of the UK area's as well as inside that another page for each security service within that area then I am just adding the companies links to each of the relevant pages. In a nutshell the same company link/advert is shown on multiple pages which is a pain in the backside to update and edit as I am having to update multiple pages for every listing. Basically what happens is a company fills out the form on my site telling me what services they offer and what locations they are based. So the info I get will have for example, "security guarding, door supervisors, key holding" and "North East, North West, Midlands, Scotland". What I then do, after putting that info into an Excel spreadsheet is update the individual pages with that companies link, which in this example would be 12 pages (North East security guarding, North East door supervisors, then North West security guarding etc, etc). Is there a way in which I can set up a database or use the database that I already have within Excel to update the listings in my html pages (I use Dreamweaver also). Ideally what I'd like to do is input the company name and relevant links/information then fill in some check boxes on a spreadsheet and then let that automatically update the relevant pages? Hope that makes sense. I'm kind of expecting this to not even be possible but you never know until you ask. Thanks for your time.
-
PHP Form Checkbox Mail
GalaxyTramp, THANK YOU!!!! Works perfectly, and such a simple mistake, doh!! Again, thanks to all who have given time to help. Really appreciate it.
-
PHP Form Checkbox Mail
Ooops. I have actually removed that and it's still the same. I get no results from the region at all now using the code that Simple-Host Nathan suggested. Will have no hair left by the time I get this sorted, if I do!
-
PHP Form Checkbox Mail
OK, have done that but now I'm back to getting no information from the regions. My mail received looks like this; CompanyName: Test Company Website: Test www. Email: Test@ Description: Testing Regions: Could it be something else in the form? I really have no idea when it comes to PHP other than what's needed for a basic contact form. Before changing the script as you suggested I would receive the email after filling in the form with two or more of my check boxes (i.e. UK Wide & Scotland) selected I received this information; CompanyName: Test Company Website: Test www. Email: Test@ Description: Testing Regions: UKWide (It only ever show's one of the checkbox values, not all the selected ones) Thanks for the help and time so far guys. Really appreciated.
-
PHP Form Checkbox Mail
OK, I've managed to get one of the check boxes working. If I make multiple selections I only receive one of the selection values in my email. Any ideas? I've added the following code into my PHP which returns only one of the selected check boxes $Regions = Trim(stripslashes($_POST['Regions'])); So now my full PHP looks like this <?php $EmailFrom = "info@uksecurity-directory.co.uk"; $EmailTo = "info@uksecurity-directory.co.uk"; $Subject = "Contact Form"; $CompanyName = Trim(stripslashes($_POST['CompanyName'])); $Email = Trim(stripslashes($_POST['Email'])); $Website = Trim(stripslashes($_POST['Website'])); $Description = Trim(stripslashes($_POST['Description'])); $Regions = Trim(stripslashes($_POST['Regions'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "CompanyName: "; $Body .= $CompanyName; $Body .= "\n"; $Body .= "Website: "; $Body .= $Website; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Description: "; $Body .= $Description; $Body .= "\n"; $Body .= "Regions: "; foreach($_POST['Regions'] as $Regions){ $Regions = $Regions . "\n"; } $Body .= $Regions; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?>
-
PHP Form Checkbox Mail
Really appreciate your help so far, but I still can't get this to work. I'll post the whole code in case something I missed off earlier is important. The form code; <form method="post" class="required-form" action="php/addcompanyengine.php"> <ul class="forms"> <li><label for="CompanyName"><em class="required">*</em> Company Name:</label> <input type="text" name="CompanyName" id="CompanyName" class="required" /></li> <li><label for="Email"><em class="required">*</em> Email</label> <input type="text" name="Email" id="Email" class="required" /></li> <li><label for="Website"><em class="required-form">*</em> Website:</label> <input type="text" name="Website" id="Website" class="required" /></li> </ul> <p class="Region">Please select the region/regions that your security services can cover</p><br /> <ol> <li><label class="checkbox">UK Wide</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="UKWide" /></li> <li><label class="checkbox">Scotland</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="Scotland" /></li> <li><label class="checkbox">North East</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="NorthEast" /></li> <li><label class="checkbox">North West</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="NorthWest" /></li> </ol> <ol> <li><label class="checkbox">Yorkshire</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="Yorkshire" /></li> <li><label class="checkbox">West Midlands</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="WestMidlands" /></li> <li><label class="checkbox">Wales</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="Wales" /></li> <li><label class="checkbox">East Midlands</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="EastMidlands" /></li> </ol> <ol> <li><label class="checkbox">East Anglia</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="EastAnglia" /></li> <li><label class="checkbox">London</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="London" /></li> <li><label class="checkbox">South West</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="SouthWest" /></li> <li><label class="checkbox">South East</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="SouthEast" /></li> </ol> <ol> <li><label class="checkbox">Northern Ireland</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="NorthernIreland" /></li><br /> </ol> <p class="Region">Please select the security services you provide</p><br /> <ol> <li><label class="checkbox">Keyholding</label> <input name="Services" type="checkbox" class="checkbox" id="Services[]" value="Keyholding" /></li> <li><label class="checkbox">CCTV</label> <input name="Services" type="checkbox" class="checkbox" id="Services[]" value="CCTV" /></li> <li><label class="checkbox">Close Protection</label> <input name="Services" type="checkbox" class="checkbox" id="Services[]" value="CloseProtection" /></li> <li><label class="checkbox">Door Supervisors</label> <input name="Services" type="checkbox" class="checkbox" id="Services[]" value="DoorSupervision" /></li> <li><label class="checkbox">Residential Security</label> <input name="Services" type="checkbox" class="checkbox" id="Services[]" value="ResidentialSecurity" /></li> </ol> <ol> <li><label class="checkbox">Security Dogs</label> <input name="Services" type="checkbox" class="checkbox" id="Services[]" value="SecurityDogs" /></li> <li><label class="checkbox">Security Guards</label> <input name="Services" type="checkbox" class="checkbox" id="Services[]" value="SecurityGuards" /></li> <li><label class="checkbox">Security Kit & Equipment</label> <input name="Services" type="checkbox" class="checkbox" id="Services[]" value="SecurityKit" /></li> <li><label class="checkbox">Surveillance & Investigations</label> <input name="Services" type="checkbox" class="checkbox" id="Services[]" value="Surveillance" /></li> <li><label class="checkbox">Training Companies</label> <input name="Services" class="checkbox" type="checkbox" id="Services[]" value="Training" /></li> </ol> <p class="Region"></p> <br /> <ul> <li><label for="Description">Description:<br /><br /> (Silver listings only <br /> <br /> Restricted to 40 words)</label> <textarea name="Description" cols="20" id="Description"></textarea> </li> <li><input type="submit" name="submit" value="Submit" class="submit-button" /></li> </ul> </form> </select> And my PHP Script is as follows <?php $EmailFrom = "info@mywebsite.co.uk"; $EmailTo = "info@mywebsite.co.uk"; $Subject = "Contact Form"; $CompanyName = Trim(stripslashes($_POST['CompanyName'])); $Email = Trim(stripslashes($_POST['Email'])); $Website = Trim(stripslashes($_POST['Website'])); $Description = Trim(stripslashes($_POST['Description'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "CompanyName: "; $Body .= $CompanyName; $Body .= "\n"; $Body .= "Website: "; $Body .= $Website; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Description: "; $Body .= $Description; $Body .= "\n"; $Body .= "Regions: "; foreach($_POST['Regions'] as $region){ $Regions = $region . "\n"; } $Body .= $Regions; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> The e-mail I'm receiving after submit is hit has all of the information, followed by region: but then it doesn't show the selected region information?
-
PHP Form Checkbox Mail
Guy's need some help. I've got a contact form which works fine, including validation. I can't figure out how to get the information selected in my checkboxes sent with the rest of the email. This is bit of the code I have for my form; <label class="checkbox">UK Wide</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="UKWide" /> <label class="checkbox">Scotland</label> <input name="Regions" type="checkbox" class="checkbox" id="Regions[]" value="Scotland" /> And my PHP engine is; $EmailFrom = "info@mysite.co.uk"; $EmailTo = "info@mysite.co.uk"; $Subject = "Contact Form"; $CompanyName = Trim(stripslashes($_POST['CompanyName'])); $Email = Trim(stripslashes($_POST['Email'])); $Website = Trim(stripslashes($_POST['Website'])); $Description = Trim(stripslashes($_POST['Description'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "CompanyName: "; $Body .= $CompanyName; $Body .= "\n"; $Body .= "Website: "; $Body .= $Website; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Description: "; $Body .= $Description; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); Basically I have no idea how to retrieve the data from the checkboxes and as my PHP knowledge is pretty basic I'm really struggling with the info I'm finding on-line. Any help would be appreciated. Cheers.
-
Should I be concerned about W3C error
Renaissance-Design: Thanks for editing my error in the post.
-
Should I be concerned about W3C error
Thank you. Very much appreciated. I had a feeling it might have been the meta definition that was wrong but couldn't find anywhere that confirmed it for me. Oddly enough I've also looked at lots of website's source code for hints and many have the same error. Again thanks for the reply.
-
Should I be concerned about W3C error
Guy's I'm using the W3C markup validator and it's telling me this. Line 21, Column 49: Bad value cache for attribute content on element meta: The legacy encoding declaration did not start with text/html;. <meta http-equiv="Content-Type" content="cache"> Syntax of legacy character encoding declaration: The string text/html;, optionally followed by whitespace, followed by charset=, followed by an encoding name labeled as a "preferred MIME name" in the IANA Character Sets registry. Example: text/html; charset=utf-8 This is my code; <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="cache"> Now I'm trying to self teach the whole webdesign thing so am not entirely sure what to do to correct it if needed. I'm struggling to find anything on the net that explains the content="cache" in lamens terms. Two questions, anyone know of anywhere where I can learn the specifics of the above meta's and a should I be worried about it not validating?? Many thanks.
-
Pointing non www. to www.
Perfect. All done and working. Thank you!
-
Pointing non www. to www.
Thanks for that link. I'm getting a 200 code response so looks like I'll need to change it.
-
Pointing non www. to www.
I recently learned it could be beneficial to have my non www. site pointing to www. and understand that I need to change the .htaccess (I think!). Now I have my hosting with 1&1, so mailed their help centre on how to go about this. The response they sent back said "your site is automatically accessible on both the www. and non www. versions. This is already set up when you sign up and both domain versions are working correctly". That seemed to me that they misunderstood what I was asking so I mailed again asking if I can do a permanent redirect from the non www. to the www. to avoid the possibility of duplicate content and received the same message back! Has anyone else had any dealings with this subject and 1&1 and have any advice, and is the risk of my site being classed as duplicate content really that likely?? Many thanks.
-
Thinking of signing upto seomoz
Jumping in here but I just had a look at that Pear Analytics and it is very helpfull. Thanks.
-
Google Analytics
According to 1&1 it says that all page impressions from one computer are aggregated into 1 visit. It also says that the data could be inaccurate if my site is being looked at in a cyber cafe as it only registers one visit per ip address. So going by that, that would mean that 700 different ip address have visited my site? My page impressions as of this morning show 1,441 according to 1&1?
-
Google Analytics
Apologies if this is in the wrong section. I have a website with 1&1 and there seems to be a discrepancy between the 1&1 analytics and Google Analytics. Anyone know why this might be or encountered it before. I thought maybe 1&1 are padding up their results to look better, but then maybe Google aren't as accurate as it's an outside application?? The results I am getting are these. Google : 24/07/11 - 23/08/11 = 74 visits with a bounce rate of 41.89% 1&1 : 27/07/11 - 23/08/22 = 686 visits and can't find the bounce rate. This also shows 370 odd visits from SE bots (mainly Google) but even taking that into consideration it still leaves 300 visitors compared to Google's recorded 74. That is a massive difference or am I being a plonker Rodney??? Also on a side note, am I right in thinking that backlinks won't show on checkers or programmes like Web CEO until the backlinking site is crawled? Many thanks.
-
IE Problems
Thanks for all the advice guys. It seems's the only problem was me not closing the <a href="">. It is now all sorted. I will go through the validation that Zed suggested and check for further errors. Thanks again.
-
IE Problems
Spot on. That solved it perfectly. Thanks!
-
IE Problems
Yeah sorry, I wasn't very specific. Basically if you look at the link from my post in Chrome it should show a basic advert with a header and description, logo and visit website button all surrounded by a border with a blue background inside the border. In windows IE 7 and 8 everything falls outside if the border/ooverlaps and just looks a mess. Chrome and Safari are both good, it's just IE7&8!
-
IE Problems
Thanks for the advice. I actually have a habit of checking my site after every single adjustment I make as I'm still learning and am trying to understand what effect each adjustment gives. The amount of problems I've had with this individual advert though has had me pulling my hair out and caused many hours of just staring at the screen in confusion!! It's seems just as I got it right on chrome etc, it still doesn't work on IE! I will check the margins and padding, I'm pretty sure they're already set how you e suggested but will confirm. Thanks again.