Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

onLoad and onSubmit question

Javascript coding ..

Moderators: macek, egami, gesf

onLoad and onSubmit question

Postby denis300 » Mon Jan 10, 2011 7:43 pm

Hi everyone,

The issue I am having is wrapping my mind around this situation. I have html tables and each row will need to be retrieved from the database when the page is loaded. ex. questions with answers loaded from database.

Now, when someone answers the questions, they will be submitted to the database. Is it possible to have an onLoad(load questions and answers), and onSubmit(submit answers), on the same line for each row in the table?

Thanks in advanced.
denis300
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon Jan 10, 2011 7:39 pm

Re: onLoad and onSubmit question

Postby mayhemiz » Tue Jan 18, 2011 10:55 am

Try to use jquery and ajax,that would work.
Here some help:
Code: Select all
function Search(str,type,from)
{
if (str == '') {
alert('You cannot search for nothing!');
} else {
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("content").innerHTML=xmlhttp.responseText;
   var myTD=document.getElementById('left');
   myTD.parentNode.removeChild(myTD);
    }
  }
xmlhttp.open("GET","index.php?t=search&str="+str+"&tyype="+type+"",true);
xmlhttp.send();
}
}


This is a code what i was use =)
mayhemiz
New php-forum User
New php-forum User
 
Posts: 38
Joined: Thu Dec 09, 2010 8:13 am

Re: onLoad and onSubmit question

Postby Prensil » Sat May 14, 2011 12:34 am

I think you can ajax to submit each answer from a row but for onload event you need to think...

Thanks & Regards,
Prensil Technologies Pvt. Ltd.
php web development company
http://www.prensil.com
Prensil
New php-forum User
New php-forum User
 
Posts: 81
Joined: Sat May 07, 2011 12:05 am

Re: onLoad and onSubmit question

Postby gandahar » Wed Jul 06, 2011 10:32 am

if you dont want tu use ajax or jquery, you can use a simple form with target="myIFRAMEname" and send data via the hidden iframe to the php script, just like a normal form, but with the target targeting to the iframe :)

i use this solution in my projects
User avatar
gandahar
New php-forum User
New php-forum User
 
Posts: 112
Joined: Tue Mar 15, 2011 4:05 am


Return to JavaScript

Who is online

Users browsing this forum: No registered users and 0 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.