Jump to content

jwk811

Members
  • Posts

    714
  • Joined

  • Last visited

    Never

Everything posted by jwk811

  1. yes that was what i was looking for lol thank you
  2. i know theres a way but i just forget. i want to do a switch function. switch ($_GET['page']) { case 0: include 'page'; break; case 1: include 'page1'; break; case 2: include 'page2'; break; default: include 'page'; } ?> just like that but if there is no $_GET page i just want it to do the default. instead of doing if isset GET page do switch else default page. i just want it to be simpler by doing something like switch(isset$_GET etc.
  3. ok at least i know im not crazy lol. i use godaddy. ill ask them about it but i doubt they will be able to do anything. maybe i should just change servers. any suggestions?
  4. i tried what you said. it shows the array. it shows the array with the data SOMETIMES just like it did with the form. this is absouletly crazy. someone please try it out yourself. put data in the text field and submit it. it works. then go back refresh form do it again. tell me if it doesnt work sometimes. and also on page 2. resend data. once resent it usually doesnt show data. http://frozenasfs.com/form/formp1.php i even tried it on two different website servers. and this is all thats on each page exactly. formp1.php <form method="post" action="formp2.php"> <input type="text" name="text" id="text"> <input type="submit"> </form> formp2.php <?php if (isset($_POST)){ var_dump ($_POST); }else{ echo "No POST data!"; }?>
  5. this is so frustrating. i know my coding isnt wrong. the most basic form doesnt even work (always). formp1.php <form method="post" action="formp2.php"> <input type="text" name="text" id="text"> <input type="submit"> </form> formp2.php <?php echo $_POST['text']; ?> heres the thing it works SOMETIMES. i send the form and it shows. i go back and do it again and it doesnt. another time it shows another time it doesnt. all the same text input to. i put the number 1. what could possibly do this? its not my browser i tried 2 different browsers. it makes no sense what so ever someone give me something PLEASE
  6. i made a quick example of the problem im having. at step 5 i dont get the data for some reason. and its weird because when i resend the data it usually works by clicking refresh page. is very frustrating and makes no sense. please help <?php if(!isset($_GET['step'])){ ?> <form method="post" action="form.php?step=2"> <input type="text" name="text" id="text"> <input type="submit"> </form> <?php } else if($_GET['step'] == 2){ ?> <form method="post" action="form.php?step=3"> <input type="hidden" name="text" id="text" value="<?php echo $_POST['text']; ?>"> <input type="text" name="text2" id="text2"> <input type="submit"> </form> <?php } else if($_GET['step'] == 3){ ?> <form method="post" action="form.php?step=4"> <input type="hidden" name="text" id="text" value="<?php echo $_POST['text']; ?>"> <input type="hidden" name="text2" id="text2" value="<?php echo $_POST['text2']; ?>"> <input type="text" name="text3" id="text3"> <input type="submit"> </form> <?php } else if($_GET['step'] == 4){ ?> <form method="post" action="form.php?step=5"> <input type="hidden" name="text" id="text" value="<?php echo $_POST['text']; ?>"> <input type="hidden" name="text2" id="text2" value="<?php echo $_POST['text2']; ?>"> <input type="hidden" name="text3" id="text3" value="<?php echo $_POST['text3']; ?>"> <input type="text" name="text4" id="text4"> <input type="submit"> </form> <?php } else if($_GET['step'] == 5){ echo $_POST['text']; echo $_POST['text2']; echo $_POST['text3']; echo $_POST['text4']; } ?>
  7. no i havent that will work but is there anyway i can make it call a function if a form field is selected already on refresh if its on the one that needs a function
  8. i have a select form. when they click a certain option a js function is used to change something. the problem is when the page is reloaded that option is automatically still selected even when i have another one auto selected. this makes it so the option that is supposed to cause a function is already selected and the function isnt done so it messes things up. how can i make it so i can change the default selected option or auto load a function if its going to be selected on refresh. (im not sure how confusing that was or not)
  9. oh ok i thought you could use order by and group by together. i wanted it to group but also in order by date. i can choose just one then if both isnt possible. thanks =]
  10. i have a column with different data examples ex1 ex2 ex1 ex2 ex1 ex2 when i select it i want to group them by the name so they will come out like this.. ex1 ex1 ex1 ex2 ex2 ex2 i thought thats what "group by" was for but it only brought up one of the data each like this ex1 ex2 how can i do this? thanks!
  11. i want to count one column but get other info from more than one table at the same time
  12. $sql = "SELECT sum(tbl1.number) FROM tbl1, tbl2"; it only works if i have one table when i add the second it doesnt work. i just need the sum in one column from one table i just need other info from the other table too it wont work tho. im getting an entirely different number for the sum.
  13. i have a select input on a form. i want the options to be long but the box they click smaller and cut off so when they click it it shows everything bigger. i tried stlying width and overflow hidden and stuff but i cant seem to get it to work. is this even possible?
  14. im having a problem where two requests are messing up eachother i have a chat on the page that uses ajax but i am also trying to use ajax to show data on the page. im not sure how to make 2 requests work together. this is the javascript page with the two functions and objects. i dont know what im doing this was my attempt that didnt work great. please help var xmlhttp = createObject(); var xmlhttp2 = createObject2(); var lastMessage = 0; var mTimer; function createObject() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if(window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else { document.getElementById('p_status').innerHTML = 'Status: Cound not create XmlHttpRequest Object. Consider upgrading your browser.'; } } function createObject2() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if(window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else { document.getElementById('p_status').innerHTML = 'Status: Cound not create XmlHttpRequest Object. Consider upgrading your browser.'; } } function getChatContent() { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("chat_content").innerHTML=xmlhttp.responseText; //chat_div.innerHTML += '<p><div style="float:left;"><img src="' + avatar_node[0].firstChild.nodeValue + '" width="50"></div><div style="float:left;"><font class="chat_user">' + user_node[0].firstChild.nodeValue + '</font> <font class="chat_time">' + time_node[0].firstChild.nodeValue + '</font><br /><font class="chat_text">' + text_node[0].firstChild.nodeValue + '</font></div></p>'; document.getElementById("chat_content").scrollTop = document.getElementById("chat_content").scrollHeight; } } mTimer = setTimeout('getChatContent();',1000); xmlhttp.open("GET","http://" + location.host + "/lib/getMessage.php?chat=1",true); xmlhttp.send(); } function showWorkoutInfo(str) { if (str=="") { document.getElementById("workoutRoutines").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp2=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp2.readyState==4 && xmlhttp2.status==200) { document.getElementById("workoutRoutines").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","getInfo.php?id="+str,true); xmlhttp.send(); }
  15. it works 9 outta 10 times now. so uhh i guess i can deal with it for now. if you have any other suggestions let me know thanks for your help =]
  16. i put that and i tried it and i was like wow that worked. and i kept switching to different options and it worked like 9 times in a row then it started not working again and sometimes even the data is from a different table which makes no sense. its the other ajax i have in the javascript for the chat. so thanks i think its a little bit better now? lol but still same problem just not as bad haha wow this makes no sense any other suggestions?
  17. part of the form: <td width="100%"><select name="select_workout_routine" id="select_workout_routine" onchange="javascript:showWorkoutInfo(this.value);"><option value="0" selected>-----Choose Your Full Body Routine-----</option><?php$sql = "SELECT id, workout_name FROM user_workouts WHERE workout_type = 'full' AND user_id = '0'";$result = dbQuery($sql);while ($row = dbFetchAssoc($result)){extract($row);echo "<option value=\"" . $id . "\">";echo $workout_name;echo "</option>";}?></select><br><br></td> the javascript: function showWorkoutInfo(str){if (str=="") { document.getElementById("workoutRoutines").innerHTML=""; return; }if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("workoutRoutines").innerHTML=xmlhttp.responseText; } }xmlhttp.open("GET","getInfo.php?id="+str,true);xmlhttp.send();} getInfo.php <?phpheader("Expires: Sun, 19 Nov 1978 05:00:00 GMT");header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");header("Cache-Control: no-store, no-cache, must-revalidate");header("Cache-Control: post-check=0, pre-check=0", false);header("Pragma: no-cache");include '../lib/config.php';$id = $_GET['id'];echo "<span style=\"color:white;\"><b>MUSCLE ORDER: <select name=\"\" id=\"\">";$sql = "SELECT id AS order_id, order_name FROM workout_routine_order WHERE id = '$id'";$result = dbQuery($sql);while ($row = dbFetchAssoc($result)){extract($row);echo "<option value=\"" . $order_id . "\">";echo $order_name;echo "</option>";}echo "</select></b></span><br><table>";$sql = "SELECT id AS order_id, order_name FROM workout_routine_order WHERE id = '$id' LIMIT 1";$result = dbQuery($sql);$row = dbFetchAssoc($result);$first_id = $row['order_id'];$sql = "SELECT *, id AS exercise_id FROM workout_exercises WHERE workout_id = '$id' AND order_id = '$first_id' ORDER BY ex_order ASC";$result = dbQuery($sql);while ($row = dbFetchAssoc($result)){extract($row);echo "<tr>";echo "<td width=\"40%\"><input type=\"checkbox\" name=\"\" id=\"\" value=\"";echo $exercise_id;echo "\" checked><label for=\"\"><b>";echo $ex_muscle;echo "</b></label></td>";echo "</tr>";}echo "</table>";?>
  18. This is so frustrating, I don't understand why this might be happening. I have a select form input that uses onchange to send a ajax request to show the data. It works. Then I click again it doesnt work, click another select option it works, then back to the other works, then the next doesnt then doesnt then doesnt then does... sorry it just seems so random there are only 2 options right now and they work every like 4 clicks going back and forth on average. There has to be an explaination, how can I fixed this. I googled it and read something about caching which makes no sense and I added the headers like it said: header("Expires: Sun, 19 Nov 1978 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); to the php page. Please save me from this frustration please.
  19. wow "last sunday" is a perometer? and if its sunday it would need to just get todays data. but i can figure that out. thanks
  20. i want to select * from table where date >= sunday whats the easiest way to get the date format for the last sunday?
  21. tytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytytyty
  22. xmlhttp.open("POST", 'lib/sendMessage.php', true); the url needs to change on every page. that will work for just the home page. other pages would need ../lib/sendMessage.php because they are in different folders. how can i make it so it works no matter what page they are on. i tried putting the domain like http://www.domain.com/lib/sendMessage.php but that does not work! i thought i could use my web root from my php function and <?php echo WEB_ROOT; ?> but that wont work. there has got to be a way and i want it so you dont have to type in the url and it gets the url itself like my web_root function does so it can be used with different websites PLEASE HELP!!
  23. nevermind it doesnt even work when i put the full url in. its an ajax thing xmlhttp.open("GET","lib/getMessage.php",true); that works for only the front page. but if i go to a different folder it wont work because the url changes. if i put xmlhttp.open("GET","http://www.domain.com/lib/getMessage.php",true); that doesnt work tho! why??? i know this is more ajax/js now but please help
  24. i use a php function to get "http://www.domain.com" when i go to my javascript file and try to go <?php echo WEB_ROOT; ?> it doesnt work. so is there a way to use php in a javascript if not is there a way to get the website with js?
  25. nevermind i got it. i did this $sql = "SELECT * FROM chat_messages"; $result = mysql_query($sql); $num = dbNumRows($result); $last = 10; $num = $num - $last; $sql="SELECT * FROM chat_messages ORDER BY message_id ASC LIMIT $last,$num";
×
×
  • 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.