Jump to content

Nodral

Members
  • Posts

    397
  • Joined

  • Last visited

Everything posted by Nodral

  1. Nodral

    Visibility Bug

    Hi All Not sure if this will sit with CSS or Javascript as it's a bit of both. This code works fine in FF but in IE7 (which most of my audience use) it has issues. The process should be that the user clicks the first button and it hides the first and shows the second. The user clicks the second button and it hides the second and shows an input form. However I have 3 issues which I cannot understand. [*]The main 500 line input form shows from the start in IE7 even thought the visibility is set to hidden until the button is pressed. [*]I cannot set the cell width in the input form regardless of what px i put in, it stays the same (this occurs in FF too) [*]In IE, when the form is finally set to visible, I get borders around the text input fields, again these are set to hidden See code below <!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script language="javascript" type="text/javascript"> //Countdown Clock JS script var c=600; var t; function timedCount(){ //convert c to mins + secs minVar = Math.floor(c/60); if (c % 60==0) {secVar="00"; } else {secVar = c % 60;} document.getElementById('txt').value= minVar + ":" + secVar; c=c-1; t=setTimeout("timedCount()",1000); if (c<=-1) { alert('Out of time'); c=200; stopCount(); //submit on timeout document.forms["data"].submit(); } } function stopCount(){ clearTimeout(t); } // hide the download button and show the 'start test' button function hide() { document.getElementById('download').style.visibility = "hidden"; document.getElementById('test').style.visibility = "visible"; } // hide the start test button and show the test form function show() { document.getElementById('form_input').style.visibility = "visible"; document.getElementById('test').style.visibility = "hidden"; } </script> <?php //create form for input ?><style language="text/css"> table{ border-collapse:collapse; } #input { border:none; } #clock { border:3px solid red; background-color:yellow; font-family:verdana; font-size:16pt; font-weight:bold; position:fixed; top:10px; right:30px; margin-left:auto; margin-right:auto; width:200px; z-index:1000; } #txt { border:none; background-color:yellow; font-family:verdana; font-size:16pt; font-weight:bold; width:70px; } td{ text-align:center; border:solid black 1px; } img{ text-decoration:none; border-style:none; } #form_input{ visibility:hidden; position:absolute; top:163px; z-index:100; } #test{ visibility:hidden; position:absolute; top:0px; } #download{ visibility:visible; position:absolute; top:0px; } #header{ position:fixed; top:0px; z-index:20; } #cell{ } #number{ background-color:#EFEBDE; font-size:12px; width:23px; border-left:2px solid #715F64; } #country{ width:80px; } </style> </head> <body> <?php // process the info and display if test is completed if(isset($_POST['form_submit'])){ echo "hello, the answer is " . $_POST['country1']; // $_POST['country'number''] // $_POST['accriss'] // $_POST['cost'] // $_POST['account'] } else { ?> <div id="button"> </div> <div> <!-- button images--> <a href='download.php' onClick="hide()"><img id="download" src='button.png'><a href='#' onClick="show(); timedCount();"><br><img id="test" src='button2.png'></a> </div> </div> <div id="form_input"> <img id="header" src="header.png"> <div id="clock"> Time Left<br> <form><input type="text" id="txt"></div></form> <!-- create the answer form--> <form id="data" method="POST" action=""> <input type="hidden" name="form_submit" value="yes"> <table> <tr><td id="number">&nbsp</td><td id="country">Country</td><td id="accriss">Acriss Code</td><td id="cost">Cost</td><td id="account">Account Number</td></tr> <?php for ($i=1; $i<=500; $i++){ ?> <tr><td id="number"><?php echo $i; ?></td> <td id="country"><input id="input" type="text" name='country<?php echo"$i"; ?>'></td> <td id="accriss"><input id="input" type="text" name='accriss<?php echo"$i"; ?>'></td> <td id="cost"><input id="input" type="text" name='cost<?php echo"$i"; ?>'></td> <td id="account"><input id="input" type="text" name='account<?php echo"$i"; ?>'></td></tr> <?php } ?> </table> </form> </div> <?php } ?>
  2. Sorted it. I'd missed out my speech marks on the element id Cheers
  3. HI I have an image which is a link to open a file in excel. What I want to happen is once the user has clicked the image once and the excel file has opened, the image to disappear of the page. I've tried but can't seem to sort it. <script language="javascript" tyep="text/javascript"> function hide() { document.getElementById(download).style.visibility = "hidden"; } </script> </HEAD> <BODY> </BODY> </HTML> <!-- create form for input --> <style language="text/css"> td{ text-align:center; border:solid black 1px; } img{ text-decoration:none; border-style:none; } #form{ visibility:hidden; } </style> <div id="download"> <a href='download.php' target='new' onClick="hide()"><img src='button.png'></a>. </div> download.php simply opens an excel file from the server into excel rather than a IE window. Any ideas?
  4. Provided the values are all give as ##kg substance You can build a function to explode and return just the bit you need. eg function get_value($input){ $value=explode("kg",$input); $result=$value[0]; return $result; } Then if you do $salt=get_value(1kg of salt); .. .. .. repeat for all ingredients then use the script that AyKay wrote, you should be ok. If the string is coming out of wordpress in a variable eg $salt="1kg of salt", then just do $salt=get_value($salt) to split the number off. NOTE: This will only work if the string is in the format ##kg of substance
  5. Hi All Not sure if this is possible, but I spend loads of time filling in the same form on a 3rd party website when people send me their details to check. Is there any way I am able to build a php script to read and check their details (can do this bit) and then submit them to a form on another website (can't do this bit)? The form is a hotel booking form and is spread over 4 pages.
  6. Use a SWITCH statement to create a variable which is how much you need to add to the current date (i.e. days, months, years) then using the DateTime functions as mentioned by Muddy_funster you'll be able to sort your problem. PS We're not here to do your work for you, you'll need to put some effort in yourself rather than just asking for us to give you the solution.
  7. Hi All I have a script which imports values from a csv file created using excel. However there are several blank values within the file where the person creating it has used blank columns to create whitespace in the file. I have used array_filter to remove these from the array, however how do I remove the redundant keys and 'squash' everything together so it is nice and neat? eg import would be , ,id, , surname, ,firstname, ,DOB, , address, , which returns array after array_filter [1]-> id [3]->surname [5]->firstname [7]->DOB [9]->address I want to return as an array which would be Is there a function to do this or would I need to create a custom one?
  8. Create a JOIN on columns 'nastavnik' on both tables, provided they reference each other then you can select from both tables dependant on you WHERE clause. As per other posts tho, very difficult to know what you want without seeing the query.
  9. You can use a Google app which will search the web and find you tutorials about how to set up a PHP/MySQL driven site, or you can put your hand in your pocket and pay someone on here to write your code for you.
  10. Hi all I'm trying to set up a simple MySQL database and the first 3 tables will set up fine, but I cannot get a reference table to set up foreign keys. See my SQL below, I'm getting the following error SQL
  11. Now you're just making things up!!! lol
  12. But surely if you're running the same query against 3 different fuorum id's this would be the logical way to do it? I'm not sure I fully understand what you are trying to acheive.
  13. If you have the id's in an array called $forumid[] , you can iterate through it and run the same query over and over <?php foreach($forumid as $value){ $results = $this->registry->db->query_read(" SELECT title, threadid, $value, dateline FROM " . TABLE_PREFIX . "thread WHERE postuserid = " . intval($this->profile->userinfo['userid']) . " AND sticky != 1 AND forumid IN (13, 19, 39) ORDER BY dateline DESC LIMIT 0,50 "); mysql($sql); //Do what you want with the results of query } ?>
  14. Use the method that voip has quoted, then create a new file for each page
  15. Hi On this line $headers .= "content-type: text/html\r\n\"; You are escaping the closing quote Is there a reason for the slash before the "?
  16. That's not an error. It's a NOTICE. All it's telling you is you're using variables which are previously undeclared. In PHP it's good practice to declare all variables before use, but not totally essential.
  17. Put a clause in like the following if(strlen($number)<0){ $number="NULL"; } This will put a value of NULL into the number rather than a blank. If you look at the SQL statement, you are creating an error when you do it the original way $query = "INSERT INTO table (Id, Name, Number) VALUES (1, 'Bradley Cooper, )"; And the comma at the end and difference between the columns and values given will cause the script to fall over. Another way, would be to quote the number you are putting in with backticks. $query = "INSERT INTO table (Id, Name, Number) VALUES (1, '$name',`$number` )"; This way you actually insert the value of $number as a literal and if it is blank, it will write a blank value into the column.
  18. Try looking into using html forms with php and MySQL. If you write the registration details into a DB you can call these back via php whenever you need.
  19. Probably the best approach is to create a function to do this, then you can reuse whenever you need. I have a couple which I have built to convert unix timestamps to HH:MM:SS or DD:MM:YY as required. The date/time fuctions within MySQL may also be handy if you're interacting with a DB. If you read the php & MySQL manauls, you'll find loads of options
  20. Try $query = mysql_query("SELECT * FROM `chicken_names` WHERE `gender` = 'Hen' AND `name` LIKE '%".$s_terms."%' ORDER BY `likes` DESC") or die(mysql_error()); If it still doesn't work, post your error
  21. If you're looking to actually send mails out to these people, have a look at RMAIL, can be found and downloaded from Google fairly simply. You simply set addresses subject etc as variables and then include their mail section which will send the mails from your server. It will save you loads of time trying to write a similar app.
  22. Cheers for that I've read the information in the manual, but this describes how to prepare to download a file, rather than insert into an HTML page. I'm not the best with headers etc. Can someone help me with how to use the readfile() function. As in previous posts, I have some image files I have created and saved which I need to load into the page.
  23. The tmp folder is at a higher level than my document root. Is there a way I can call an image file from there using php prior to sending to the browser?
  24. Create file - This works fine $filename="/home/httpd/vhosts/xxxxxx.co.uk/tmp/line_all".$identify . $_SESSION['USERID'] . ".jpg"; include"graph.php"; graph.php creates the jpg and saves to $filename. <table id="line"><tr><td id="border"></td><td id="top">It is recommended that you complete the questionnaire periodically to monitor if your Learning Style is changing over time.<br><br> The chart below shows the development of Learning Styles over a period of time and should help you to adjust to any changes you have experienced</td><td id="border"></td></tr><tr><td id="border"></td><td id="bottom"><img src="<?php echo "/home/httpd/vhosts/xxxxxx.co.uk/tmp/line_all".$identify . $_SESSION['USERID'] . ".jpg"; ?>" width="500" height="500"></td><td id="border"></td></tr><tr></table></p> This is the output code, which cannot find the image flie which has saved successfully. The file permissions get set to 777 in graph.php
×
×
  • 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.