Jump to content

Need some help with my php script (thelia based)

- - - - -

  • Please log in to reply
No replies to this topic

#1
blink41

blink41

    Newbie

  • Members
  • PipPip
  • 11 posts
Hi all !
I'm currently doing my training period and my subject is to create some kind of catalog for the company I'm working for. I decided to use a script already made that's called 'Thelia' (it's an e-commerce script). I'm modding it to fit with my company's products, and yet I got some little problems.
I used Ajax in order to get what I want.
Basically, I got a textbox that must be filled with some data depending on the choice made in a dropdown list. I can see some text, but I can't see the words separated by a space, for example : "I don't know" will result in a "I" alone in the textbox.
Here is a sample of my code :
$sql="SELECT * FROM fil WHERE fil = '".$q."'";

$result = mysql_query($sql);


while($row = mysql_fetch_array($result))
  {
 // echo "<tr>";
//  echo "<td>" . $row['composition'] . "</td>";
//echo "</tr>";
  			echo				"Composition du Fil 1:<input class='form_long' type='compositionFil1' name='compositionFil1' id='compositionFil1' maxlength='10' disabled value=".$row['composition'].">";
  			echo				"Titrage (Fil 1):<input class='form_long' type='titrageFil1' name='titrageFil1' id='titrageFil1' maxlength='10' disabled value=".$row['titrage'].">";
  			echo				"Filateur (Fil 1):<input class='form_long' type='filateurFil1' name='filateurFil1' id='filateurFil1' maxlength='10' disabled value=".$row['filateur'].">";
  			echo				"Poids (Fil 1):<input class='form_long' type='poidsFil1' name='poidsFil1' id='poidsFil1' maxlength='10' disabled value=".$row['poids'].">";
  			echo				"Prix (Fil 1):<input class='form_long' type='prixFil1' name='prixFil1' id='prixFil1' maxlength='10' disabled value=".$row['prix']."> \n";

And in my main script here is a sample of code :
<script type="text/javascript">
function showFil(str)
{
if (str=="")
  {
  document.getElementById("compositionFil1").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("compositionFil1").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getFil.php?q="+str,true);
xmlhttp.send();
}
</script>	

I hope I've been clear enough, but if you have any questions or if you want more details don't hesitate to ask me.
Thanks !

EDIT: Found the solution, thanks anyway !

Edited by blink41, 26 April 2010 - 05:00 AM.
Found the solution





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users