|
ok
look at this code
<script src="yourpage.js"></script>
<form>
<select name="c" onchange="showchange(this.value)">
<option value = "c1"> C1
<option value = "c2"> C2
<option value = "c3"> C3
<option value = "c4"> C4
</select>
</form>
an at yourpage.js
type
var xmlHttp
function showchange(str) {
xmlHttp = GetXmlHttpObject();
if (xmlHttp==null)
{
alert("your browser deosn't support AJAX");
return;
}
var url = "url" <- your link
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=statechanged;
xmlHttp.OPEN("GET",url,true);
xmlHttp.send(null);
}
function statechanged()
{
if (xmlHttp.readystate==4"number of chooses")
{
document.getElementById("txtHint").innerHTML=xmlHttp.responsetext;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
xmlHttp = new XMLHttprequest();
}
catch(e) {
try
{
xmlHttp = new ActiveXObject("Msxm12.XMLHTTP");
}
catch (e)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
|
|
|
|
|
Thank you for the code and the effort.
I have tried it but it does not seem to be doing anything.
Moreover i need a procedure where it will enter the changes into the databases and also re-directing me to a new page when a submit button is clicked.
|
|
|
|
|
hi, i am trying to include functions from a php review script in my original web layout, to do this i changed my pages from .htlm to .php and i'am using the include_once function to call the script.
for some reason when i include the script all code execution halts after it has been callled and focus does not return to the anti-insect.php page so the footer for my site is not shown. im not sure if i need to change a return value for the script or not.
this is also preventing me from using multiple include_once to import two or more functions and display them in different area's on my website.
this is very frustrating if any one could help me out i would be really happy, i have also included a link to the site that i am testing using the xampp server.
http://92.8.199.227/Anti-Insect.php
thankyou
chris
|
|
|
|
|
Hi,
First of all, link given by you is not working.. Another thing is include_once can be used once check this php manual page.
http://php.net/manual/en/function.include-once.php[^]
Either explain your problem in detail or give sample code you are trying... So we can help you properly...
|
|
|
|
|
i think i got ur problem
that's because the HTML code at ur included script
|
|
|
|
|
Hello, my problem is the following: i have a query with 3 results from a database where i store a school timetable datas such as professors, courses etc...I try to put this results in a html tabel dynamic via php.So, for exemple i have courses from 8 to 10, 10 - 12 and 17 - 19.I have "if" conditions in while loop that allow me to verify if i have a course at x hour.If i dont have course at x hour i want to fill the table with empty cell " ".But the real problem is that when i try to do this while loop is displaying the tested conditions plus empty rows cuz of else condition , ofc it is doing like this cuz if the query has x results he will construct x times those empty rows...i dont know if somebody is understanding me and what i need to do.I will attach a piece of code here:
while($linie = mysql_fetch_assoc($rez))
{
if($linie['ziua'] == "Luni")
{
$orastart = $linie['orastart'];
$orafinal = $linie['orafinal'];
$nume_curs = $linie['nume_curs'];
$prof_name = $linie['prof_name'];
$nume_grupa = $linie['nume_grupa'];
if($orastart == "8" && $orafinal <= "10")
{
echo "<tr><td>8 - 9</td><td rowspan = '2'>".$nume_curs."<br />".$prof_name."<br />".$nume_grupa."</td></tr>";
echo "<tr><td>9 - 10</td></tr>";
}
else echo "<tr><td>8 - 9</td><td> </td></tr>
<tr><td>9 - 10</td><td> </td></tr>";
if($orastart >= "10" && $orasfarsit <= "12" )
echo "<tr><td>10 - 11</td><td rowspan = '2'>".$nume_curs."<br />".$prof_name."<br />".$nume_grupa."</td></tr>
<tr><td>11 - 12</td><td> </td></tr>";
else echo "<tr><td>10 - 11</td><td> </td></tr>
<tr><td>11 - 12</td><td> </td></tr>";
}
}
echo "</table>";
|
|
|
|
|
The trick is to get the cells of the table in the right order. There are many ways to do so.
1.
use a two-dimensional array; fetch the database results (order does not matter); loop over them filling the array; when filled, start creating the table from the array.
2.
use a one-dimensional array representing one day; for each day, fetch the database results for that day only; fill the array; now generate HTML for one row.
3.
fetch all the database results in chronological order (use an ORDER BY clause). Now start reading the results and create your array; start a new row when day does not equal previous day; insert one or more empty cells when time chunks aren't consecutive; etc.
|
|
|
|
|
ty for u'r fast answer i rly aprishiate.I will come back with news :P
|
|
|
|
|
i tryed u'r first method but i am a little bit confused in creating the array.Here is what i tryed:
$rezultate = array();
while($linie = mysql_fetch_assoc($rez))
{
$rezultate[] = $linie;
}//while
if($rezultate[0]['orastart'] == "8" && $rezultate[0]['orastart'] <= "10")
{
echo "<tr><td>8 - 9</td><td rowspan = '2'>".$nume_curs."<br />".$prof_name."<br />".$nume_grupa."</td></tr>";
echo "<tr><td>9 - 10</td></tr>";
}
else echo "<tr><td>8 - 9</td><td> </td></tr>
<tr><td>10 - 11</td><td> </td></tr>";
u can see how i acces the elements from array but i want to acces different, something like this:
if($rezultate[$i]['orastart'] == "8" && $rezultate[$i]['orastart'] <= "10")
|
|
|
|
|
pelikan2002 wrote: $rezultate[] = $linie;
that is completely wrong.
in that scheme you need a 2D array, which you give dimensions according to number of days and number of time periods in a day; then iterate over all database results and fill the corresponding cell of the array.
|
|
|
|
|
ok...i quited first method cuz i have no idea how to do it, but u'r second method sounds better because my sql query is how u told me just for 1 day.My query is :
SELECT classes.day, classes.starthour, classes.finalhour, course.nume_curs, proffessor.prof_name,groups.group_name
FROM classes, proffessor, course,groups
WHERE classes.profid = proffessor.profid
AND course.coursid = classes.courseid
AND classes.groupid = groups.groupid
AND classes.day = 'Monday'
.Here is a print with my results What i dont understand is what do u mean by "creating one row" and can u give me an exemple how that array should look?.Thank you
|
|
|
|
|
I'm not going to give PHP code; what follows is pseudo-code to create one HTML table row between firstHour and lastHour:
0. create an empty array representing the relevant hours (or quarters or whatever time unit you choose) for one day.
1. run your SQL query for that day
2. foreach result from SQL query mark the hour(s) in the array
3. now generate HTML code for one row of your HTML table, starting with TR tag
4. foreach hour between firstHour and lastHour look in your array and create either an empty table cell, or a filled table cell using TD tag, P tag, etc.
5. close table row with /TR tag
|
|
|
|
|
thank you very much for ur pseudo-code sir.This is very usefull.
|
|
|
|
|
ok ..
you end with
<pre>
echo "</table>";</pre>
<code>but where is the start "<table>" tag ?</code>
=======================
<pre>echo "<table border=1>";
if($orastart == "8" && $orafinal <= "10")
{
echo "<tr><td>8 - 9</td><td rowspan = '2'>".$nume_curs."<br />".$prof_name."<br />".$nume_grupa."</td></tr>";
echo "<tr><td>9 - 10</td></tr>";
}
else echo "<tr><td>8 - 9</td><td>&nbsp;</td></tr>
<tr><td>9 - 10</td><td>&nbsp;</td></tr>";
if($orastart >= "10" && $orasfarsit <= "12" )
echo "<tr><td>10 - 11</td><td rowspan = '2'>".$nume_curs."<br />".$prof_name."<br />".$nume_grupa."</td></tr>
<tr><td>11 - 12</td><td>&nbsp;</td></tr>";
else echo "<tr><td>10 - 11</td><td>&nbsp;</td></tr>
<tr><td>11 - 12</td><td>&nbsp;</td></tr>";
}
}
echo "</table>";</pre>
|
|
|
|
|
I'm successfully calling a mysql stored procedure using PDO with the following line:
$pdoCmd->fetch(PDO::FETCH_OBJ)
It returns an object that I need to get converted into an integer, seems straightforward enough but when the object is say "1000" and I cast to an int I get a value of 1.
How can I convert an object to an integer and keep my zeroes?
|
|
|
|
|
Think I figured it out:
$objResult = $pdoCmd->fetch(PDO::FETCH_OBJ);
$intValue = (int)$objResult->MyColumnName;
Cheers
|
|
|
|
|
Dear all,
any one can help me.....!
Problem: i have window base server where tomcat is installed.i want to detect tomcat when start up. i want to run bat file when tomcat start up.
tell me how i configure Apache tomcat what should be the solution?
behind the reason of this problem is ..i want to call http url when tomcat start.
i will write http url in bat file and i want this bat file will be execute when tomcat start.
|
|
|
|
|
due to lack of software they have provided which is not working on fedora
how TO install it 
|
|
|
|
|
Maybe this[^] can help
"I'm willing to admit that I may not always be right, but I am never wrong." - Samuel Goldwyn
|
|
|
|
|
there is an error that ~lmysqlclient not found
HELP with sample Coding example
and compiling procedure 
|
|
|
|
|
Make sure you have the mysql-devel RPM installed.
|
|
|
|
|
Hi friends !
We have already html forms or flash file(.swf).
How can we do to "Embed html forms or flash into facebook".
Any ideas or link to do it step by step!
Thanks !
|
|
|
|
|
Hi,
I have a vb program which communicates with PHP but cut long story short it works
What i want to know is if i develop this PH further can i create a login screen on the internet and allow the user to amend records?
e.g if a teacher did a register of a class and messed it up could they login online and edit the absent and present column?
Please note i am new to PHP!
Thanks
Dan
|
|
|
|
|
The answer is "maybe"...
If the records you want to amend are stored in a database that you have access to using PHP, then you can do whatever you like with them, assuming you have the required permissions.
Sorry the answer is a bit vague, but you asked quite a vague question.
|
|
|
|
|