Jump to content

stevengreen22

Members
  • Posts

    119
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

stevengreen22's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm currently working with someone on a site and we've gotten to the point where we're looking for feedback or suggestions etc. The site is currently located at www.steve-t-green.com/perspect/index.php If you could have a peek and maybe take a moment to fill this in : http://kwiksurveys.com/app/rendersurvey.asp?sid=5dt1vdmfhapx00y222151&refer= I'd be hugely grateful. Failing that any and ALL criticisms are welcome. A couple of notes, any links that do not work is intentional, any pages that are not there is also intentional. Many many thanks.
  2. Hi all, This problem is killing me. I hope / pray someone can help. Essentially I need to pass a JS variable to a PHP variable without refresh/form submission or redirecting. I'm new to Ajax so please be patient The owner of this site generally lives in 3 countries lucky ******. When he logs in he wants the contact page updated with his current number. I have a form with hidden fields that return the address location using an ajax call to ipinfo.io - this works fine. <script> $(function() { var admin = <?php echo json_encode($admin->isAdmin($user['username'])); ?>; var phone=""; if(admin == true){ $.ajax({ url:"http://ipinfo.io", dataType:'jsonp' }) .success(function(response){ $("#address").val(response.country); $("input[id=address]").val(response.country); var testLoc = $('#address').val(); if(testLoc == "GB"){ phone = "<?php echo $gb?>"; $("#phone").append(phone); }else if(testLoc == "GABON"){ phone = "<?php echo $gabon?>"; $("#phone").append(phone); }else if(testLoc == "THAILAND"){ phone = "<?php echo $thai?>"; $("#phone").append(phone); } }); var time = new Date(); $("#localTime").append(time); }else{ //alert("Not Admin"); $("#phone").append(phone); } }); </script> The above essentuially checks to see that he is THE admin, if it is it then sets the hidden field value to be the country, that is then placed in the testLoc variable and depending on what it is, it spits out the number. This all works well unless of course you visit the site and you're not the admin. All you see is an empty string. I need to get that phone variable or location variable, either of them really from the js into a php variable. That way when a normal joey visits the page I can just echo out that variable instead. phone or location var in js script to php variable?
  3. Hi, I'm turning a 2 level nav into a 3 level and running into a few difficulties. The 3rd level displays where and as predicted but when the 'grandparent' is hovered over, not the parent of the items I want displayed. I've been fooling around with the css for a while and I cannot get it to respond how I'd like. Any help is appreciated. There is a fiddle as my explanation might be somewhat lacking. http://jsfiddle.net/6TGaf/ Code from fiddle: #nav{ background: #bada55; width: 99%; margin-top:-5px; } #nav ul{ list-style: none; margin: 0; padding: 0; height: 40px; } #nav ul li{ /*child elements positioned absolutley will be relative to this*/ position: relative; border-top: 1px solid #e9e9e9; float: left; } #nav a{ color: ghostwhite; padding: 12px 0px; /*fill hori space*/ display: block; text-decoration: none; /*apply transition to background property, taking 1s to change it */ transition:padding 1s, background 1s; -moz-transition:padding 1s, background 1s; -webkit-transition:padding 1s, background 1s; -o-transition:padding 1s, background 1s; font-family:tahoma; font-size:13px; text-transform:uppercase; padding-left:20px; } /*hover pseduo class*/ #nav a:hover{ /* RGBA background for transparancy: last number(0.05) is the transparency */ padding-left:35px; background: RGBA(255,255,255,0.05); color:#fff; } #nav ul li:hover ul{ /*diplay when hovered*/ display: block; } #nav ul ul{ position: absolute; left: 0px; top: 40px; border-top: 1px solid #e9e9e9; display: none; /*width: 304px;*/ z-index: 1; } #nav ul ul li{ width: 150px; background: #f1f1f1; border: 1px solid #e9e9e9; border-top: 0; /*float:left;*/ } #nav ul ul li a{ color:#000000; font-size:12px; text-transform:none; } #nav ul ul li a:hover { color:#929292; } /*3rd level...*/ #nav ul ul ul{ position: absolute; left: 150px; top: 0px; border-top: 1px solid #e9e9e9; display: none; /*width: 304px;*/ z-index: 1; } #nav ul ul ul li{ width: 150px; background: #f1f1f1; border: 1px solid #e9e9e9; border-top: 0; } #nav ul ul ul li a{ color:#000000; font-size:12px; text-transform:none; } #nav ul ul ul li a:hover { color:#929292; } #nav ul ul li:hover ul{ /*diplay when hovered*/ display: block; } <nav id = "nav"> <ul> <li> <a href="#">1.1</a> <ul> <li> <a href="#">1.1.1</a> <ul> <li><a href="#">1.1.1.a</a></li> <li><a href="#">1.1.1.b</a></li> </ul> </li> <li><a href="#">1.1.2</a></li> <li><a href="#">1.1.3</a></li> </ul> </li> </ul> </nav>
  4. OK, I think I was getting confused. I was trying to cirumnavigate the problems for when I try and access the includes from a different folder in the root. 2 levels down for example and I've just realised that this doesn't actually solve that. Would $file = dirname(__FILE__) be on the right track to solve?
  5. oh ok, changed to .class.php. In my dbconnect.class.php I only have : $config = array( host etc details ); $db = new PDO('mysql:host=' .$config['host'] . ';dbname=' .$config['dbname'], $config['username'], $config['password']); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); Is there any problems there? when you mentioned class name and file name I got a touch confused. This doesn't have typical class structure
  6. Hi, It was dbConnect.php. I then tried dbconnect.php and dbconnect.class.php. It's now dbconnect.php again
  7. Hi, yup, checked all of those and they're all fine. I've tried various tests and so far have come up with this result... If I include the dbconnect file using require before I call the spl_autoload it works. I tried putting the dbconnect file into the same folder as the classes to test - it failed there too.
  8. I have : session_start(); spl_autoload_register(null, false); spl_autoload_extensions(".class.php"); function classLoader($class){ $filename = strtolower($class) .'.class.php'; $file = 'core/classes/' .$filename; if(!file_exists($file)){ return false; } require $file; } function connectLoader($connect){ $filename = strtolower($connect) .'.class.php'; $file = 'core/connect/' .$filename; if(!file_exists($file)){ return false; } require $file; } spl_autoload_register('connectLoader'); spl_autoload_register('classLoader'); In an init.php that is called at the top of each page. I keep receiving errors with regards to non member objects when trying to access the site. Fatal error: Call to a member function prepare() on a non-object in /home/a6696695/public_html/core/classes/users.class.php on line 185 on that line is a function that retrieves user data from the database: //function to return the user data public function userData($id){ $query = $this->db->prepare("SELECT * FROM users WHERE id =?"); $query->bindValue(1, $id); try{ $query->execute(); //returns all user data in the form of an array - access in other pages, index etc. return $query->fetch(); }catch(PDOException $e){ die($e->getMessage); } }//end userData function This function is called in the init after the spl calls. //instantiating the classes $users = new Users($db); $admin = new Admin($db); $general = new General(); $helper = new Helper(); //check if user is logged in, get id from session and data if($general->loggedIn() === true){ $userId = $_SESSION['id']; $user = $users->userData($userId); } Help please
  9. Issues with formatting in here -.- This works fine...if it's not the first time a user visits the site. This is the mess I get after inspecting with firebug: value="<br><table border='1' cellpadding='2' bgcolor='#FFFFDF' bordercolor='#E8B900' align='center'><tr><td><font face='Arial' size='1' color='#000000'><b>PHP Error Message</b></font></td></tr></table><br /> <b>Notice</b>: Undefined index: cookieUserEmail in <b>/home/a6696695/public_html/contact.php</b> on line <b>231</b><br /> <br><table border='1' cellpadding='2' bgcolor='#FFFFDF' bordercolor='#E8B900' align='center'><tr><td><div align='center'><a href='http://www.000webhost.com/'><font face='Arial' size='1' color='#000000'>Free Web Hosting</font></a></div></td></tr></table>" name="email" style="width: 200px;"> It's a feature that I'd like to keep but I can't find a solution. I tried declaring the cookie variables right at the start to be empty strings but that failed. Am I missing something obvious(again)?
  10. Hi all, I've a contact form with a save details option. <div class="ourContactFormElement"> <label for="email"><span class="requiredField">*</span>Your Email:</label> <input type="text" name="email" class="required email" value="<?php echo $_COOKIE["cookieUserEmail"]; ?>"<?php if(isset($_POST['email'])){ echo 'value="', htmlspecialchars($_POST['email'], ENT_QUOTES, 'UTF-8'), '"';} ?> /> </div>
  11. That makes so much more sense now. I feel ashamed. You are now on my christmas card list
  12. Hi all, I'm trying to avoid using external libraries as much as possible, mainly because I'd liek to try and understand things myself instead of relying on their code. I've got an email working fine that displays in HTML courtesy of some online guides / tutorials and a fair bit of frowning. I now need to embed some GIF's or images into it but I'm having zero success. The images are stored on the server and have been used in various other places so I'm certain the path is correct as I thought this may be the issue. If I take an example from CSS-Tricks and use a http:..... path image. It works fine but I don't want to do this, I'd like to tell it that the file is "images/bla.gif" and so on. I've found some help online but after trying examples I'm still in the same position that I was before. Could someone take a look at the code and help please? $subject = "Contact Form"; $headers = "From: " .$email. "\r\n"; $headers .= "Reply-To: " .$email. "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; //body of message $message1 = '<html><body>'; $message1 .= '<table rules="all" style="border-color: #666;" cellpadding="10">'; $message1 .= "<tr style='background: #eee;'><td><strong>Name:</strong> </td><td>" .$name. "</td></tr>"; $message1 .= "<tr><td><strong>Email:</strong> </td><td>" .$email. "</td></tr>"; $message1 .= "<tr><td><strong>Company Name:</strong> </td><td>" .$companyName. "</td></tr>"; $message1 .= "<tr><td><strong>Contact Number:</strong> </td><td>" .$contactNumber. "</td></tr>"; $message1 .= "<tr><td><strong>Message:</strong> </td><td>" .$message. "</td></tr>"; $message1 .= "</table>"; $message1 .= '<IMG SRC="images/loading.gif" alt="GAAAAAh"/>'; -- THIS DIESN"T WORK - THE ONE BELOW DOES -.- $message1 .= '<img src="http://css-tricks.com/examples/WebsiteChangeRequestForm/images/wcrf-header.png" alt="Website Change Request" />'; $message1 .= "</body></html>"; if (mail($myEmail, $subject, $message1, $headers)) {
  13. Wow, thanks guys, I wasn't expecting so much and the above class is pretty awesome I went back to basics so to speak to try and understand the problem a bit better. There are many different types of units that will need to be converted so I was working on a select boxes that auto populated depending on the previous choice. This then menat leaning or attempting to learn jquery and js in part to try and understand those functions needed. I'll then piece this all together. Hopefully:)
  14. Hey all, I'm trying to write a fairly intensive unit converter. I only want to use PHP to achieve it. There's tons of online material for a JS version but that won't do I'd also like to use classes as well to help organise things (and it's what I know). The problem is...I don't really know where to start. I'm intending on having a form of course where a user can select a unit type and how many of that unit. The output will then display all the other units for that measurement. So length for example : 1 cm would output 10 mm; metres, yards etc etc For my other forms I've used POST to get the details but I found an example online that uses method="$_SERVER['PHP_SELF']" instead could someone be kind enough to guide me in the right direction please? Many thanks
×
×
  • 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.