Jump to content

gish

Members
  • Posts

    92
  • Joined

  • Last visited

    Never

Everything posted by gish

  1. how do you create favicon.ico animation?
  2. I know what the problem is, but i don't know how to fix it. Inside the function I did the following line. echo print_r($posted_variable,1); Which I should not do in oop but for testing purposes =). The output is the following, It gets the array but does not pass on the array values. Any ideas Array ( [0] => business [1] => performance [2] => budget [3] => structure [4] => goals [5] => customer [6] => document [7] => aims [8] => swot [9] => systems [10] => work [11] => delegate )
  3. Thanks for that it now i am getting some errors, which is great =) Fatal error: Cannot access empty property in /online.php on line 109 109 is this one, return $this->$Missed; when I posted it on the other page, I did not select two values so it should have the value of 2. does any one have any idea?
  4. hi, chronister helped with some of the code in the sorting_class early today. Now I am trying to do the same thing with oop. The code below is what i already. But I can't get any values to return and i get no errors. Is anyone able to help. class question_collation { private $posted_variable; private $Yes = 0; private $No = 0; private $Unsure = 0; private $Missed = 0; private $k; public function sorting_class ($posted_variable){ //posted variable is setup so as to sort if it is a yes no or unsure foreach($posted_variable as $k) { switch($_POST[$k]) { case '': $this->Missed++; break; case 1: $this->Yes++; break; case 2: $this->No++; break; case 3: $this->Unsure++; break; } } } public function missed_return(){ return $this->$Missed; } public function yes_return(){ return $this->$Yes; } public function no_return(){ return $this->$No; } public function unsure_return(){ return $this->$Unsure; } } $posted_variable = array('business','performance','budget','structure','goals','customer','document','aims','swot','systems','work','delegate'); $question_collation_object = new question_collation; $question_collation_object ->sorting_class ($posted_variable); echo $question_collation_object ->missed_return . '<br/>This is the missed'; echo $question_collation_object ->yes_return . '<br/>This is the yes'; echo $question_collation_object ->no_return . '<br/>This is the no '; echo $question_collation_object ->unsure_return . '<br/>This is the unsure'; ?>
  5. Thanks I never thought of putting the array into a variable (sillly me, I should know that ) that was what I was missing. =)
  6. Ok I have been doing some thinking. I am think what I am asking is there a way to count the Post variable array then put it into a loop so i can extract the numbers 1,2,3.
  7. hi phpfreaks I am creating a questionnaire for my website but I am having trouble the script. Each question has three options that will be posted 1,2,3 1 meaning yes, 2 meaning no, and 3 unsure. When it gets submitted to the next page I have to sort the amount of 1, 2 and 3's. Is there and easier way other than using the if statement for every post variable or can I use a loop statement? below is what I have so far. what I want to know is there a way to get the if ($_POST[business] == 1){ $Yes = $Yes + 1; } elseif ($_POST[business] == 2){ $No = $No + 1; }else{ $Unsure = $Unsure + 1; } echo $_POST[business]; echo $_POST[performance]; echo $_POST[budget]; echo $_POST[structure]; echo $_POST[goals]; echo $_POST[customer];
  8. I have been doing some reading and I have done the following the time keep changing but the int is not working so is the code below on the right tract $time=time(); echo $time; // int turns it string into a number $num_time = (int)$time; $num_time = $_SESSION['session_time']; echo " Time Logged On: " . $insert . $_SESSION['session_time'] . " </span>" ;
  9. hi phpfreaks I know that the logged in time above would have to use at database but does it use a time() function. the code I have below must be very wrong i know. right now I get either 0 or 14. All I want to do right now is when the page refreshes it will tell the user how long they have been on the site. I know I can do this with javascript but have bigger plans for the outcome that involve php. I just am at a loss to know how to go about it. does anyone have ideas $current_time = date("H:i:s"); $_SESSION['session_time'] = $current_time - $_SESSION['session_time']; echo " Time Logged On: " . $insert . $_SESSION['session_time'] . " </span>" ;
  10. gish

    stopwatch

    hi phpfreaks I want to create a timer in php. What I want to know would it be appropriate to use a session variable. I am having trouble with the concept I think. Has anyone created one before? thanks gish
  11. gish

    ajax form

    hi I have a form that works great and I have an ajax script that works great but as soon as I place the form into the ajax script it keeps losings the post value I assuming i need to add something but I don't know what? the ajax openpage has the php code include("form.php"); this is the form echo "<form method='post'>"; echo "<input type=text name='form_value' value='' MaxLength='2' size='' style='text-align:center; width:150px; height:90px; border-color:white; font-family:arial, verdana:bold; font-size:80px' tabindex='0' >"; echo "<br>"; echo "<input type=submit value='' style='width:0px; height:0px; font-family:arial, verdana:bold; font-size:px' >"; echo "</form>"; function getNewXMLHttpRequest() { var findbrowser; try { findbrowser = new ActiveXObject('Microsoft.XMLHTTP'); } catch(a) { try { findbrowser = new XMLHttpRequest(); } catch (a) { findbrowser = false; } } return findbrowser; } function check1() { if (request.readyState ==4) { var randomDiv = document.getElementById("pictjs"); randomDiv.innerHTML = request.responseText; } } function ajaxselection(){ /// this is for the ajax request = new getNewXMLHttpRequest(); var url ="openpage.php"; request.open("GET", url, true); request.onreadystatechange = check1; request.send(false); } window.onload = menus; function menus(){ ajaxselection(); }
  12. Hi am I able to call a method from another class in the same script by doing the following random_class ($_POST['form_value']); or do i have to create a object inside the function like i have below $random_object = new random($_POST['form_value']); $random_object ->random_class($_POST['form_value']);
  13. hi I am having trouble with an if statement that I created in oo and I am wondering does anyone know if what I am doing is correct? this is the statement if ($correction_object->correction_checked() = 1){ this is the error i get Fatal error: Can't use method return value in write context public function correction_function () { // the if statement is for startup will skip correction if gobals // have not had the chance to obtain properties if ($_SESSION['$answer'] = ''){ random_function(); } else { correction_true_false ($_POST['form_value']); if ($correction_object->correction_checked() = 1){ // send it to the correction function random_function (); } else { //needs to return to last figures $_SESSION['$number1']; $_SESSION['$number2']; } } } public function correction_true_false ($correction_post){ if ($_SESSION['random-answer'] == $correction_post){ $this->correction_outcome = 1; } else { $this->correction_outcome = 0; } }
  14. Hi everyone, I need some direction to make sure my oop is correct. Inside the class i have the following functions. But the function random_class has to make a choice from a session variable. What I want to know is it alright to call the session variable directly or do I do it through the object call in the script if so how do I do it correctly? class random { private $correction_outcome; private $random_post; private $answer_string; private $Name; function __construct($random_post) { $this->random_outcome = $random_post; } public function random_class ($random_post){ //this is a will setup a cass choice so that it can choose a function $Name = $_SESSION['form_value']; //this needs to be a session switch($Name) { case "Jim": random_au(); break; case "Linda": random_su(); break; case "Bob": random_mu(); break; default: print "I'm broken and I don't know why\n"; } } public function random_checked() { return $this->random_outcome; } } the object call is this, $random_post = $_POST['form_value']; $random_object = new random($random_post); $random_object ->random_class($random_post); echo $random_object->random_checked(); If you see anything else that is wrong do tell me oo is still very new =)
  15. hi phpfreaks how do i use a function to call a function in oop and what is the term used in php for what I am asking for? Thanks for any help =) gish
  16. hi everyone I have setup up my web page so that after a form button is clicked 20 times the page automatically freshes itself. That works fine but that the creates and issue because I have pressed the submit button it posts the data then refreshed itself. but because it it refreshes anything that was posted it will ask if you want to post it again. What I want to know is there anyway to error catch it so that I dodge it or clear the post variable. gishaust
  17. Thanks I have been doing some reading with the difference of opinion.
  18. hi how do i get href to pass a php variable. I am thinking something like this!! <a href="thesamepage.php" onclick="<?php $variable='this is a variable';?>">wow</a> All I want is the variable become a session variable and then return to the same page but I am drawing a blank =). thanks gish
  19. hi everyone, I have a script that when you come to my web page you will be diverted to another part of the site if it comes from a mobile phone. What I want to know is what kind of sizes do I have to play with. so that i can create a site that is smaller does anyone know how I could fine some information out on it? gish
  20. thanks for your help =)
  21. I am not worried I am trying to learn. You need to learn by correction. Do you mean bad code by me I was using it as an example not the actual code I was going to use.
×
×
  • 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.