SunQuest
           PHP Applications
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Applications

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old March 29th, 2007, 11:12 AM
krthk_sg krthk_sg is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: India
Posts: 7 krthk_sg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
php-help needed in calling a function using onclick-urgent

<?php
require($DOCUMENT_ROOT . "test50.php");
?>

<?php
$a=0;
function callfunc($a)
{
$result2 = mysql_query("SELECT * FROM `student1` LIMIT $a, 10 ");
echo "<table border='1'>";
echo "<tr>";
echo "<th>NAME</th><th>ROLLNO</th><th>CLASS</th><th>CONTACTNO</th>";
echo "</tr>";
while($row2 = mysql_fetch_array($result2))
{
echo "<tr>";
echo "<td>".$row2['name'] . "<td>" . $row2['rollno'] . "<td>" .$row2['class'] . "<td>" . $row2['contactno'];
echo "</tr>";
echo "<br />";
}
echo "</table>";
}
callfunc($a);
echo "$a";
echo "<br />";
$a+=10;
echo "<br />";
echo "$a";
//echo '<INPUT type="button" value="NEXT" onClick="callfunc($a);" />';
mysql_close($con);
?>
<INPUT type="button" value="NEXT" onClick="callfunc(<?php echo $a ?>);" />
</script>
</body>
</html>

Reply With Quote
  #2  
Old March 29th, 2007, 12:51 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: php-help needed in calling a function using onclick-urgent

Your function function callfunc($a) is a PHP function that resides in a .php file on the server. You cannot "call" this function by placing it in a link or in any javascript event in the browser.

The way to do this to make the code of the function its own .php file, then put the URL of this file in the link or in the javascript event.

Since you have this in an <input field, are you attempting to have a form submit data to your php file? If so, you need to code a proper form with <form ...>your form fields here</form>. When you submit the form, it will "call" the .php file that is given in the action="..." parameter.

Reply With Quote
  #3  
Old March 30th, 2007, 06:28 AM
krthk_sg krthk_sg is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: India
Posts: 7 krthk_sg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: RE: php-help needed in calling a function using onclick-urgent

thank u but,i have mangaed to get the first 10 values from the database and whn i click on the button now its not showing the next ten values.my question is how do we refresh the page to get the new values and also the button problem still exist.As u have said i am using a form and doing all these activities
Quote:
Your function function callfunc($a) is a PHP function that resides in a .php file on the server. You cannot "call" this function by placing it in a link or in any javascript event in the browser.

The way to do this to make the code of the function its own .php file, then put the URL of this file in the link or in the javascript event.

Since you have this in an <input field, are you attempting to have a form submit data to your php file? If so, you need to code a proper form with <form ...>your form fields here</form>. When you submit the form, it will "call" the .php file that is given in the action="..." parameter.


Reply With Quote
  #4  
Old April 5th, 2007, 09:37 AM
ssekazinga ssekazinga is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Kampala
Posts: 1 ssekazinga User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to ssekazinga
RE: RE: php-help needed in calling a function using onclick-urgent


Quote:
Your function function callfunc($a) is a PHP function that resides in a .php file on the server. You cannot "call" this function by placing it in a link or in any javascript event in the browser.

The way to do this to make the code of the function its own .php file, then put the URL of this file in the link or in the javascript event.

Since you have this in an <input field, are you attempting to have a form submit data to your php file? If so, you need to code a proper form with <form ...>your form fields here</form>. When you submit the form, it will "call" the .php file that is given in the action="..." parameter.


Let me try it out will get bac to you!

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Applications > php-help needed in calling a function using onclick-urgent


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway