Jump to content

ann

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by ann

  1. Hi In short I want to be able to pass a 2D array from one php script to another. I've got a MAIN php script which draws a map of links and then calls another php to draw a 'clickable' image over the top of the links.  The data for the links and the image are the same so I want to pass the array of data to the image script. If anyone can tell me how it's done, or where I'm going wrong with what I'm trying below, I'd be very greatful  :) thanks This is giving me an error that I can't find a solution to... the MAIN script where the 2D array ($doms) is created... [code] # $doms is the 2D array I want to pass                 $data = serialize($doms); #$data = base64_encode(serialize($doms)); print("$data<br>");                 print("<IMG border=0 USEMAP=\"#map$dir\"SRC=\"prot_img.php?protein=$protein&data=$data\"></img>"); $doms = unserialize($data); #$doms = base64_decode(unserialize($data)); print_r($doms);[/code] the script where I want to pass the array to... [code]$doms=unserialize($_GET["data"]); ##line14[/code] and the error I get is... [code]PHP Notice:  unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Error at offset 19 of 23 bytes in prot_img.php on line 14,[/code] The unserialize works within the MAIN script but not when it's passed.  The base64 encoding in MAIN works but the decoding fails and I get the same unserialize() error for both scripts if I use the base64 encoding.
  2. Hi Is it possible to use a php include in a ssi template file? I have an ssi template with images in but the image file(s) may not exist so I want to be able to check for the file and print to the ssi file acordingly. Something like... [code]<td width="125" valign="center"><? include ("/includes/file.php"); ?></td>[/code] where file.php gives either <img SRC="/images/logo.jpg" width="125"> or nothing so I just get an empty cell. If this is possible what's the include syntax? Thanks for your time
  3. Hm! we now think this is an issue with the people who supply the nematodes.org address so we'll take it up with them.
  4. Hi Can anyone tell me what may have been changed to cause this behaviour. Our website http://www.nematodes.org/ has until recently worked with http://www.nematodes.org/ displayed in the address bar of any browser used to view it.  Now for some reason if you go to this address you are redirected to http://Machine_domain_name.ac.uk/.  This is exactly the same site but the CSS and images don't work because they're referenced as www.nematodes.org and not the machine name, which they should be to make the site portable.  I don't understand why the browsers are changing the address, I certainly haven't set-up a redirection. Anyone got any ideas what may I have done to cause this behaviour?  I don't get any messages in the error logs, not even 'image does not exist'. (NOTE the CSS is currently there because I have hard coded the machine name in the script) Thanks Our server... Fedora core 4 PHP5 Apache
  5. Thanks Did you mean document.[b]forms[/b].formName.elements.objectName ? Anyway while I was trying to get that to work I dicovered 'in' is reserved so i changed it to 'varin', gave my form the id "varform" and discovered document.forms.varform.varin[0].checked which was just what I needed so the start of the script now looks like... [code]< script type="text/ javascript">< !-- window.onload=function() { objblast=document.getElementById('BLAST'); if (document.forms.varform.varin[0].checked){} else{objblast.className='hide';} objblast2=document.getElementById('BLAST2'); if (document.forms.varform.varin[0].checked && document.forms.varform.out[0].checked){} else{objblast2.className='hide';} objgo=document.getElementById('GO'); if (document.forms.varform.varin[1].checked){} else{objgo.className='hide';} [/code] Cheers
  6. Hi I've got a php search page with javascript show/hide depending on the selected inputs.  The java script currently hides everything on load which is fine for the first visit but when a user clicks the back button after a search the options are hidden even though the selections/inputs are remembered.  See <a href="http://www.nematodes.org/test_js7.php">example</a> make any input you like then 'search' and 'browser back button'.  The radio button you selected will still be selected but the details for it are hidden. Click the radio again to see the details you input. What I want is... If it exists, get the value of the radio called 'in' and use it to deterimine show/hide for the relevant <div>. Thus the start of my script would be someting like.  [code]< script type="text/javascript"><!-- window.onload=function() { unless 'in' exists 'in'=5; objblast=document.getElementById('BLAST'); if (in!=0) {objblast.className='hide';}[/code] How do I determin if 'in' exists and get the value of it? Many thanks if you can help The code for the whole page... [code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><!-- InstanceBegin codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title> www.nematodes.org - the Home of Nematode and Neglected Genomics in the Blaxter Lab </title> <!-- InstanceEndEditable --> </head> <body> <style type="text/css"> <!--.show {display:block;}.hide {display:none;}--></style> < script type="text/javascript"><!-- window.onload=function() { objblast=document.getElementById('BLAST');objblast.className='hide'; objblast2=document.getElementById('BLAST2');objblast2.className='hide'; objgo=document.getElementById('GO');objgo.className='hide'; objkegg=document.getElementById('KEGG');objkegg.className='hide'; objec=document.getElementById('EC');objec.className='hide'; objdom=document.getElementById('DOM');objdom.className='hide'; objsim=document.getElementById('simi');objsim.className='hide'; objbit=document.getElementById('bit');objbit.className='hide'; objexp=document.getElementById('exp');objexp.className='hide'; rad=document.getElementsByTagName('input'); for(c=0;c<rad.length;c++) { if(rad[c].name=='in') {rad[c].onclick=function() { if(this.value==0) {objblast.className='show';objblast2.className='show';objgo.className='hide';objkegg.className='hide';objec.className='hide';objdom.className='hide';blst=0;} else if (this.value==1) {objblast.className='hide';objblast2.className='hide';objgo.className='show';objkegg.className='hide';objec.className='hide';objdom.className='hide';blst=1;} else if (this.value==2) {objblast.className='hide';objblast2.className='hide';objgo.className='hide';objkegg.className='show';objec.className='hide';objdom.className='hide';blst=2;} else if (this.value==3) {objblast.className='hide';objblast2.className='hide';objgo.className='hide';objkegg.className='hide';objec.className='show';objdom.className='hide';blst=3;} else if (this.value==4) {objblast.className='hide';objblast2.className='hide';objgo.className='hide';objkegg.className='hide';objec.className='hide';objdom.className='show';blst=4;} else {objblast.className='hide';objblast2.className='hide';objgo.className='hide';objkegg.className='hide';objec.className='hide';objdom.className='hide';blst="";} }} if(rad[c].name=='out') {rad[c].onclick=function() {if(this.value==0) { objsim.className='hide'; if(blst==0) {objblast2.className='show';} } else {objsim.className='show';objblast2.className='hide';} }} if(rad[c].name=='datatype') {rad[c].onclick=function() { if(this.value==0) {objbit.className='show';objexp.className='hide';} if(this.value==1) {objbit.className='hide';objexp.className='show';} }} } } //--></script> <div class="mainTitle">Search for sequences with specified annotations</div><br> <div class="mainMed">Use the form below to set key words and parameters for searching the available sequence annotations in Nembase3.</div> <br><br> <form method="post" action="test.php"> <table class="tablephp2"> <tr> <td> <table width=100%> <tr class="mainBig"> <td width=200>Annotation</td> <td>Details</td> </tr> <tr height=20></tr> <tr> <td valign="top"><input type="radio" name="in" value=0>Blast hit description</td> <td id="BLAST"> <table> <tr> <td width=400 valign="top"><input TYPE="checkbox" NAME="prog[]" checked VALUE="blastx">BLASTX (protein hits)&nbsp&nbsp&nbsp<br><input TYPE="checkbox" NAME="prog[]" VALUE="blastn">BLASTN (nt hits)&nbsp&nbsp&nbsp</td> <td width=400 valign="top"><input type="text" name="blstxt">search text</td> <td width=300 valign="top"><input type="text" style="width:40px;" name="scoretxt">Minimum e-value</td> </tr> </table> </td> </tr> <tr> <td valign="top"><input type="radio" name="in" value=1>GOtcha description</td> <td id="GO"> <table> <tr> <td width=400 valign="top"><input TYPE="radio" NAME="go" VALUE="0" checked>Description<br> <input TYPE="radio" NAME="go" VALUE="1">GO id(ie GO:0006950 ) </td> <td width=400 valign="top"><input type="text" name="gotxt">search text</td> <td width=400 valign="top"><input type="text" style="width:40px;" name="conf">min confidence (1-100)</td> </tr> <tr><td colspan=3>This search is very slow!!  I'm working on speeding it up. </table> </td> </tr> <tr> <td valign="top"><input type="radio" name="in" value=2>KEGG</td> <td id="KEGG"> <table> <tr> <td width=400 valign="top"><input TYPE="radio" NAME="kegg" VALUE="0" checked>Description<br> <input TYPE="radio" NAME="kegg" VALUE="1">pathway<br> <input TYPE="radio" NAME="kegg" VALUE="2">number </td> <td width=400 valign="top"><input type="text" name="keggtxt">search text</td> </tr> </table> </td> </tr> <tr> <td valign="top"><input type="radio" name="in" value=3>Enzyme Commission</td> <td id="EC"> <table> <tr> <td width=400 valign="top"><input TYPE="radio" NAME="ec" VALUE="0" checked>description<br><input TYPE="radio" NAME="ec" VALUE="1">number</td> <td width=400 valign="top"><input type="text" name="ectxt">search text</td> </tr> </table> </td> </tr> <tr> <td valign="top"><input type="radio" name="in" value=4>Domain</td> <td id="DOM"> <table> <tr> <td width=400 valign="top"><input TYPE="radio" NAME="ip" VALUE="0" checked>Interpro description<br><input TYPE="radio" NAME="ip" VALUE="1">Domain ID</td> <td width=400 valign="top"><input type="text" name="iptxt">search text</td> </tr> </table> </td> </tr> </table> <table width=100%> <tr> <td width=200>  <!--show this cell always with this content--> <div><div class="mainBig">Output by:</div> <label><input type="radio" name="out" value=0 checked />table of sequences</label><br> <label><input TYPE="radio" NAME="out" VALUE=1 />as SimiTri</label><br><br><br> </div> </td> <td valign=top>  <!--show this cell with variable content--> <table width=400 id="BLAST2"> <!--show this div if out==0 i.e. table of clusters--> <tr> <td> <div class="mainBig">Order results by</div> <input TYPE="radio" NAME="order" VALUE="0" checked>sequence abunance<br> <input TYPE="radio" NAME="order" VALUE="1" >blast e-value </td> <td> <div class="mainBig">Report</div> <input TYPE="radio" NAME="hits" VALUE="0" checked>all hits<br> <input TYPE="radio" NAME="hits" VALUE="1">1st hit only </td> </tr> </table> <div id="simi"><table> <!--show this div if out==1 i.e. simitri--> <tr> <td width=400> <!--while out==1 show this cell always with this content--> <div class="mainBig">Select data type</div> <label><input TYPE="radio" NAME="datatype" VALUE=0 />blast bit score</label><br> <label><input TYPE="radio" NAME="datatype" VALUE=1 />sequence expression</label><br><br><br> </td> <td valign="top" width=800> <!--while out==1 show this cell with variable content--> <div id="bit"><div class="mainBig">Select databases to compare</div><? include ("simi_bit_db_selector.php"); ?></div> <!--while out==1 show this div if datatype==0 i.e. bitscore--> <div id="exp"><div class="mainBig">Select data groups to compare</div><? include ("simi_exp_db_selector.php"); ?></div> <!--while out==1 show this div if datatype==1 i.e. expression--> </td> </tr> </table></div> </td> </tr> <tr height=20></tr> <tr> <td colspan=3 valign=top> <center><input TYPE="submit" VALUE="Search"></center> </td> </tr> </table> </td> </tr> </table> </form> </body> </html> [/code]
  7. No solution but I've got to get on so I changed the button to a check box which means I can work the javascript in one form. the code [code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> < script type="text/javascript"><!-- function checkAll(){   for (i=0; i<document.forms[0].length; i++)       if(document.forms[0].elements[i].name=="org[]") document.forms[0].elements[i].checked = true } function clearAll(){   for (i=0; i<document.forms[0].length; i++)       if(document.forms[0].elements[i].name=="org[]") document.forms[0].elements[i].checked = false }//-->< /script> </head> <body> <style type="text/css"> <!--.show {display:block;}.hide {display:none;}--></style> < script type="text/javascript"><!-- window.onload=function() { obj=document.getElementById('abun') obj.className='hide'; objs=document.getElementById('simi') objs.className='hide'; rad=document.getElementsByTagName('input'); for(c=0;c<rad.length;c++) { if(rad[c].name=='out') { rad[c].onclick=function() { if(this.value==0) {obj.className='show';objs.className='hide';} else {obj.className='hide';objs.className='show';} } } } } //-->< /script> <form method="post" action="annotation_search.php"> <table class="tablephp2"> <tr> <td> <table> <tr height=20></tr> <tr> <td><div class="mainBig">Species to search</div></td> <td> <input type=checkbox onClick="if(this.checked)checkAll(); else clearAll()"> sellect all </td> </tr> <tr height=20></tr> <tr> <td><input TYPE="checkbox" NAME="org[]" value="ACC">Ancylostoma caninum</input></td> <td><input TYPE="checkbox" NAME="org[]" value="ALC">Ascaris lumbricoides</input></td> <td><input TYPE="checkbox" NAME="org[]" value="ASC">Ascaris suum</input></td> <td><input TYPE="checkbox" NAME="org[]" value="AYC">Ancylostoma ceylanicum</input></td> </tr><tr> <td><input TYPE="checkbox" NAME="org[]" value="BMC">Brugia malayi</input></td> <td><input TYPE="checkbox" NAME="org[]" value="DIC">Dirofilaria immitis</input></td> <td><input TYPE="checkbox" NAME="org[]" value="GPC">Globodera pallida</input></td> <td><input TYPE="checkbox" NAME="org[]" value="GRC">Globodera rostochiensis</input></td> </tr><tr> <td><input TYPE="checkbox" NAME="org[]" value="HCC">Haemonchus contortus</input></td> <td><input TYPE="checkbox" NAME="org[]" value="HGC">Heterodera glycines</input></td> <td><input TYPE="checkbox" NAME="org[]" value="HSC">Heterodera schachtii</input></td> <td><input TYPE="checkbox" NAME="org[]" value="LSC">Litomosoides sigmodontis</input></td> </tr> <tr height=20></tr> </table> <table width=100%> <tr> <td width=30%> <div><div class="mainBig">Output by:</div> <label><input type="radio" name="out" value=0 /> table of clusters</label><br> <label><input TYPE="radio" NAME="out" VALUE=1 /> as SimiTri</label><br> </div> </td> <td valign=top> <div id="abun"><table width=100%> <tr> <td width=30%><div class="mainBig">Order results by</div></td> <td width=30%><div class="mainBig">Report</div></td> </tr> <tr> <td><input TYPE="radio" NAME="order" VALUE="0" checked>sequence abunance</td> <td><input TYPE="radio" NAME="hits" VALUE="0" checked>all hits</td> </tr> <tr> <td><input TYPE="radio" NAME="order" VALUE="1" >blast score</td> <td><input TYPE="radio" NAME="hits" VALUE="1">1st hit only</td> </tr> </table></div> <div id="simi"><table width=100%> <tr><td><div class="mainBig">SimiTri data type</div></td></tr> <tr><td><input TYPE="radio" NAME="datatype" VALUE="0" checked>bit score</td></tr> <tr><td><input TYPE="radio" NAME="datatype" VALUE="1">expression</td></tr> </table></div> </td> </tr> <tr height=20></tr> <tr> <td colspan=3 valign=top> <center><input TYPE="submit" VALUE="Search"></center> </td> </tr> </table> </td> </tr> </table> </form> </body> </html>[/code]
  8. becasue the javascript wont work! Well not for me but if anyone would like to tell me how to make it work on one form that would be great too. The javascript for selecting output type is fine in one form but the "select all" button javascript requires an object called document.buttonDemo which I've difened in the form tag  <form method="post" name="buttonDemo"> So is there a way to defiine document.buttonDemo without using a form tag ?
  9. Hi I have a user input html page with multiple forms because the javascript won't work with one form or sub froms. My aim is to get the input data to a php script and I think the way to do that is have a final form in the html which posts all the input. Problem, how do I get the input values from other forms into the final 'submit' from?  (don't remember where I got the syntax that I've commented out but it doesn't work anyway).  ??? Many thanks if you can help. http://www.nematodes.org/test_js5.shtml My scripts html [code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style type="text/css"> <!--.show {display:block;}.hide {display:none;}--></style> < script type="text/javascript"><!-- function checkChangeAll(){ if (document.buttonDemo.onOffButton.value==" Select all "){ document.buttonDemo.onOffButton.value=" Clear all "; for (i=0; i<document.forms[0].length; i++){if(document.forms[0].elements[i].name.match(/org/)){document.forms[0].elements[i].checked = true;}} } else{ document.buttonDemo.onOffButton.value=" Select all "; for (i=0; i<document.forms[0].length; i++){if(document.forms[0].elements[i].name.match(/org/)){document.forms[0].elements[i].checked = false;}} } } //--></ script> </head> <body onload="checkChangeAll()";> < script type="text/javascript"><!-- window.onload=function() { obj=document.getElementById('abun') obj.className='hide'; objs=document.getElementById('simi') objs.className='hide'; rad=document.getElementsByTagName('input'); for(c=0;c<rad.length;c++) { if(rad[c].name=='out') { rad[c].onclick=function() { if(this.value==0) {obj.className='show';objs.className='hide';} else {obj.className='hide';objs.className='show';} } } } }//--></ script> <table class="tablephp2"> <tr> <td> <form method="post" name="buttonDemo">  <!--form[0]--> <table> <tr height=20></tr> <tr> <td><div class="mainBig">Species to search</div></td> <td> <input type="Button" value=" Select all " name="onOffButton" onClick="checkChangeAll()"> </td> </tr> <tr height=20></tr> <tr> <td><input TYPE="checkbox" NAME="org[0]" value="ACC">Ancylostoma caninum</input></td> <td><input TYPE="checkbox" NAME="org[1]" value="ALC">Ascaris lumbricoides</input></td> <td><input TYPE="checkbox" NAME="org[2]" value="ASC">Ascaris suum</input></td> <td><input TYPE="checkbox" NAME="org[3]" value="AYC">Ancylostoma ceylanicum</input></td> </tr><tr> <td><input TYPE="checkbox" NAME="org[4]" value="BMC">Brugia malayi</input></td> <td><input TYPE="checkbox" NAME="org[5]" value="DIC">Dirofilaria immitis</input></td> <td><input TYPE="checkbox" NAME="org[6]" value="GPC">Globodera pallida</input></td> <td><input TYPE="checkbox" NAME="org[7]" value="GRC">Globodera rostochiensis</input></td> </tr><tr> <td><input TYPE="checkbox" NAME="org[8]" value="HCC">Haemonchus contortus</input></td> <td><input TYPE="checkbox" NAME="org[9]" value="HGC">Heterodera glycines</input></td> <td><input TYPE="checkbox" NAME="org[10]" value="HSC">Heterodera schachtii</input></td> <td><input TYPE="checkbox" NAME="org[11]" value="LSC">Litomosoides sigmodontis</input></td> </tr> <tr height=20></tr> </table> </form> </td> </tr> <tr> <td> <form method="post" action="#"><!--form[1]--> <table width=100%> <tr> <td width=30%> <div><div class="mainBig">Output by:</div> <label><input type="radio" name="out" value=0 /> table of clusters</label><br> <label><input TYPE="radio" NAME="out" VALUE=1 /> as SimiTri</label><br> </div> </td> <td valign=top> <div id="abun"> <table width=100%> <tr> <td width=30%><div class="mainBig">Order results by</div></td> <td width=30%><div class="mainBig">Report</div></td> </tr> <tr> <td><input TYPE="radio" NAME="order" VALUE="0" checked>sequence abunance</td> <td><input TYPE="radio" NAME="hits" VALUE="0" checked>all hits</td> </tr> <tr> <td><input TYPE="radio" NAME="order" VALUE="1" >blast score</td> <td><input TYPE="radio" NAME="hits" VALUE="1">1st hit only</td> </tr> </table> </div> <div id="simi"> <table width=100%> <tr><td><div class="mainBig">SimiTri data type</div></td></tr> <tr><td><input TYPE="radio" NAME="datatype" VALUE="0" checked>bit score</td></tr> <tr><td><input TYPE="radio" NAME="datatype" VALUE="1">expression</td></tr> </table> </div> </td> </tr> </table> </form> </td> </tr> <tr height=20></tr> <tr> <td colspan=3 valign=top> <form method="post" action="test.php"> <!-- <input type="hidden" name="org" value=forms[0]> <input type="hidden" name="out" value="forms[1].out">--> <center><input TYPE="submit" VALUE="Search"></center> </form> </td> </tr> </table> </body> </html> [/code] test.php [code]<?php $orgs=$_POST['org'];  #read the org (organisms) array $output=$_POST['out'];  $orgs2=array("a","b","c","d"); print "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">"; print "<html>\n<head>\n</head>\n<body><br><center>"; print "output => $output <br> orgs=>    "; print_r($orgs); print "<br>testarray=>    "; print_r($orgs2); ?> [/code]
  10. I'm trying tp post to html thread but get 'the document contains no data' on post.  What am I doing wrong?
  11. Thanks, much appreciated. I'm not sure how it work but it does and at the moment that's what matters.  :)
  12. Hi I have a from with 5X7 text input fields. (see http://trichuris.cap.ed.ac.uk/Lumbribase/search_array.php) I want to be able to iterate through the input fields after they are posted. Idealy I'd lke to store the input in a 2D array and post the array but I don't think that's possible. So I named them A00 to A46 and post them to the next php page.  How do I get them into a form I can itterate through? I'm trying this [code]print "A00 -> $A00<br>"; for($i=0; $i<7; $i++) { for ($j=0; $j<5; $j++) { $tmp="A".$i.$j; $junk[$i][$j]=$_POST[$$tmp]; print "i=$i -> j=$j -> tmp=$tmp -> junk[i][j]=$junk[$i][$j] -> Aij=$A$i$j<br>"; } }[/code]  which gives the ouput (if the top left input (A00) is aaa) [code]A00 -> aaa i=0 -> j=0 -> tmp=A00 -> junk[i][j]=Array[0] -> Aij=00 i=0 -> j=1 -> tmp=A01 -> junk[i][j]=Array[1] -> Aij=01 i=0 -> j=2 -> tmp=A02 -> junk[i][j]=Array[2] -> Aij=02 i=0 -> j=3 -> tmp=A03 -> junk[i][j]=Array[3] -> Aij=03 i=0 -> j=4 -> tmp=A04 -> junk[i][j]=Array[4] -> Aij=04 i=1 -> j=0 -> tmp=A10 -> junk[i][j]=Array[0] -> Aij=10 i=1 -> j=1 -> tmp=A11 -> junk[i][j]=Array[1] -> Aij=11 <snip> i=6 -> j=2 -> tmp=A62 -> junk[i][j]=Array[2] -> Aij=62 i=6 -> j=3 -> tmp=A63 -> junk[i][j]=Array[3] -> Aij=63 i=6 -> j=4 -> tmp=A64 -> junk[i][j]=Array[4] -> Aij=64[/code] So how to dereference $tmp so that $_POST[$$tmp]; actually gets the variable with the name stored in the string $tmp? Thanks if you can help Ann
×
×
  • 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.