Jump to content

database storing is not working correctly


veluit06

Recommended Posts

hi

i have 4 fields, in that 4 fields if i enterd any value the output wil be displayed in the lastfield everything is using ajax, if i remove the last 2 fields, the output wil be displayed in 2 field, how to correct this problem, where i have to concentrate

Link to comment
Share on other sites

actually i design one page for linksubmission, in that page am having 4 textbox each box having button, using ajax i storing the submitted links in my database, each textbox values stored in separate table,

 

when i entered the values and submitted that time the values are stored in last table that means, if i entered values for first three text box that values all stored in last table that is 4th field table, but inside the field nothing is there, only empty space,

 

friends now u can understand i think please help me

Link to comment
Share on other sites

this is the html file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Untitled Document</title>

<script type="text/javascript" src="script/link.js"></script>

<script type="text/javascript" src="script/linkkick.js"></script>

<script type="text/javascript" src="script/linkvirus.js"></script>

<script type="text/javascript" src="script/linkchrist.js"></script>

<style type="text/css">

 

body{

font-family:Arial, Helvetica, sans-serif;

font-size:12px;

}

 

 

</style>

</head>

 

<body>

<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">

  <tr>

    <td><table width="71%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">

      <tr>

        <td> </td>

        <td> </td>

      </tr>

      <tr>

        <td colspan="2" align="center"><strong>Link Submission</strong></td>

      </tr>

      <tr>

        <td> </td>

        <td> </td>

      </tr>

      <tr>

        <td><strong>Union Shoppe Links Submission:</strong></td>

        <td width="64%"><table width="40%" border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td><input name="txtLink" type="text" id="txtLink" size="50" onkeypress="checkEnterKick(event)"/></td>

              <td><input name="cmdSave" type="button" id="cmdSave" value="UnionShoppe"  onclick="doOperation('Save')" /></td>

            </tr>

            <tr>

              <td colspan="2"><input name="htxtOpr" type="hidden" id="htxtOpr" value="0" /></td>

            </tr>

            <tr>

              <td colspan="2" align="right"><b>

                <label id="lblStatusMsgUnion" style="color:#FF3300"></label>

              </b></td>

            </tr>

        </table></td>

      </tr>

      <tr>

        <td> </td>

        <td> </td>

      </tr>

      <tr>

        <td> </td>

        <td> </td>

      </tr>

      <tr>

        <td> </td>

        <td> </td>

      </tr>

      <tr>

        <td><strong>Kick Virus Links Submission: </strong></td>

        <td><table width="60%" border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td><input name="txtLinkA" type="text" id="txtLinkA" size="50" onkeypress="checkEnterKick(event)"/></td>

              <td><input name="cmdSaveA" type="button" id="cmdSaveA" value="KickVirus"  onclick="doOper('SaveKick')" /></td>

            </tr>

            <tr>

              <td colspan="2"><input name="htxtOprA" type="hidden" id="htxtOprA" value="0" /></td>

            </tr>

            <tr>

              <td colspan="2"></td>

            </tr>

        </table></td>

      </tr>

      <tr>

        <td colspan="2" align="right"><b>

          <label id="lblStatusMsgKick" style="color:#FF3300"></label>

        </b></td>

        <td> </td>

      </tr>

      <tr>

        <td> </td>

        <td> </td>

      </tr>

      <tr>

        <td> </td>

        <td> </td>

      </tr>

      <tr>

        <td width="36%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td><strong>Virus Snipper  Links Submission:</strong></td>

            </tr>

        </table></td>

        <td><table width="40%" border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td><input name="txtLinkB" type="text" id="txtLinkB" size="50" onkeypress="checkEnterVirus(event)"/></td>

              <td><input name="cmdSaveB" type="button" id="cmdSaveB" value="VirusSnipper"  onclick="doOperant('SaveSnipper')" /></td>

            </tr>

            <tr>

              <td colspan="2"><input name="htxtOprB" type="hidden" id="htxtOprB" value="0" /></td>

            </tr>

            <tr>

              <td colspan="2" align="right"><b>

                <label id="lblStatusSnipper" style="color:#FF3300"></label>

              </b></td>

            </tr>

        </table></td>

      </tr>

      <tr>

        <td> </td>

        <td> </td>

      </tr>

      <tr>

        <td> </td>

        <td> </td>

      </tr>

      <tr>

        <td> </td>

        <td> </td>

      </tr>

      <tr>

        <td width="36%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td><strong>MyChrismasGiftz  Links Submission:</strong></td>

            </tr>

        </table></td>

        <td><table width="40%" border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td><input name="txtLinkC" type="text" id="txtLinkC" size="50" onkeypress="checkEnterChrist(event)"/></td>

              <td><input name="cmdSaveC" type="button" id="cmdSaveC" value="myChristmasgiftz"  onclick="doOperation('SaveChristmas')" /></td>

            </tr>

            <tr>

              <td colspan="2"><input name="htxtOprC" type="hidden" id="htxtOprC" value="0" /></td>

            </tr>

            <tr>

              <td colspan="2" align="right"><b>

                <label id="lblStatusChrist" style="color:#FF3300"></label>

              </b></td>

            </tr>

        </table></td>

      </tr>

      <tr>

        <td colspan="2"> </td>

      </tr>

      <tr>

        <td colspan="2" align="center"></td>

      </tr>

    </table></td>

  </tr>

  <tr>

  <td> </td>

  </tr>

</table>

</body>

</html>

 

Link to comment
Share on other sites

below is my js files

 

 

//Comm AJEX Code//

 

function GetXmlHttpObject()

{

var xmlHttp=null;

try

  {

  // Firefox, Opera 8.0+, Safari

  xmlHttp=new XMLHttpRequest();

  }

catch (e)

  {

  // Internet Explorer

  try

    {

    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

    }

  catch (e)

    {

    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

    }

  }

return xmlHttp;

}

//////////////////

 

 

//operations///////

function doOperation(opr)

{

if (opr == 'Save')

{

checkMandatory();

}

else{}

}

////////////

 

 

//Check Mandatory for Union Shoppe//////////////////////

function checkMandatory()

{

var links = document.getElementById('txtLink').value;

 

 

if(links=='')

{

alert("Please enter Your Link");

document.getElementById('txtLink').focus();

}

else

{

checkLink();

//saveLinks();

}

}

/////////////

 

//////clearall//////////

function clearAll()

{

document.getElementById('txtLink').value = "";

    document.getElementById('txtLinkA').value = "";

document.getElementById('txtLinkB').value = "";

document.getElementById('txtLinkC').value = "";

}

//end clear data//

 

 

//Key press Unionshoppe//

function checkEnter(e){ //e is event object passed from function invocation

var characterCode //literal character code will be stored in this variable

 

if(e && e.which){ //if which property of event object is supported (NN4)

e = e

characterCode = e.which //character code is contained in NN4's which property

}

else{

e = event

characterCode = e.keyCode //character code is contained in IE's keyCode property

}

 

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)

unionShoppe=document.getElementById('txtLink').value;

 

 

 

if(unionShoppe=='')

{

alert("Please enter Your Link");

document.getElementById('txtLink').focus();

}

else

{

checkLink(unionShoppe); //submit the form

//saveLinkKick();

}

 

return false

}

 

 

else{

return true

}

 

}

//////////////////////

 

 

//// Check Links for Union Shoppe////////

 

function checkLink()

{

 

var cOpr = 'cUnion';

var clink = document.getElementById('txtLink').value;

 

xmlHttp=GetXmlHttpObject();

if (xmlHttp==null)

{

alert ("Your browser does not support AJAX!");

return;

}

 

var url="php/links.php";

url=url+"?Opr="+cOpr+"&linka="+clink;

 

xmlHttp.onreadystatechange=stateSearchResDet;

xmlHttp.open("GET",url,true);

xmlHttp.send(null);

}

function stateSearchResDet()

{

if (xmlHttp.readyState==2)

{

document.getElementById("lblStatusMsgUnion").innerHTML="Processing.....";

}

else{

//alert (xmlHttp.responseText);

}

 

if (xmlHttp.readyState==4)

{

 

//alert (xmlHttp.responseText)

if(xmlHttp.responseText == 0)

{

 

saveLinks();

}

else

{

//alert (xmlHttp.responseText);

document.getElementById("lblStatusMsgUnion").innerHTML="Your Submitted Link Already Exists";

alert ("Your Submitted Link Already Exists, Thank You For Your Submission");

document.getElementById("lblStatusMsgUnion").innerHTML= "";

clearAll();

}

 

}

else{}

}

//////////////

 

 

//Save Links//

function saveLinks()

{

 

var sOpr = 'saveLink';

var slink = document.getElementById('txtLink').value;

 

xmlHttp=GetXmlHttpObject();

if (xmlHttp==null)

{

alert ("Your browser does not support AJAX!");

return;

}

var url="php/links.php";

url=url+"?Opr="+sOpr+"&linka="+slink;

xmlHttp.onreadystatechange=stateChangedstudDet;

xmlHttp.open("GET",url,true);

xmlHttp.send(null);

 

 

function stateChangedstudDet()

{

if (xmlHttp.readyState==2)

{

document.getElementById("lblStatusMsgUnion").innerHTML="Processing.....";

}

else{}

 

if (xmlHttp.readyState==4)

{

document.getElementById('lblStatusMsgKick').innerHTML="";

document.getElementById('lblStatusSnipper').innerHTML="";

document.getElementById('lblStatusChrist').innerHTML="";

document.getElementById("lblStatusMsgUnion").innerHTML=xmlHttp.responseText;

clearAll();

}

else{}

}

}

////////////

 

 

 

 

// JavaScript Document

//Comm AJEX Code//

 

function GetXmlHttpObject()

{

var xmlHttp=null;

try

  {

  // Firefox, Opera 8.0+, Safari

  xmlHttp=new XMLHttpRequest();

  }

catch (e)

  {

  // Internet Explorer

  try

    {

    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

    }

  catch (e)

    {

    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

    }

  }

return xmlHttp;

}

////////

 

 

//operations///////

function doOper(opr)

{

if (opr == 'SaveKick')

{

checkMandatoryKick();

}

else{}

}

////////////

 

 

 

/////// Check mandatory for Kickvirus////////////

function checkMandatoryKick()

{

var linksA = document.getElementById('txtLinkA').value;

 

 

if(linksA=='')

{

alert("Please enter Your Link");

document.getElementById('txtLinkA').focus();

}

else

{

checkKick();

//saveLinkKick();

}

}

/////////////

 

//Key press event//

function checkEnterKick(f){ //e is event object passed from function invocation

var charCode //literal character code will be stored in this variable

 

if(f && f.which){ //if which property of event object is supported (NN4)

f = f

charCode = f.which //character code is contained in NN4's which property

}

else{

f = event

charCode = f.keyCode //character code is contained in IE's keyCode property

}

 

 

if(charCode == 13){ //if generated character code is equal to ascii 13 (if enter key)

kickVirus=document.getElementById('txtLinkA').value;

 

 

if(kickVirus=='')

{

alert("Please enter Your Link");

document.getElementById('txtLinkA').focus();

}

else

{

checkKick(kickVirus); //submit the form

//saveLinkKick();

}

 

 

return false

}

 

else{

return true

}

 

}

 

//////////////////////

 

 

//// Check Links for Kick Virus////////

 

function checkKick()

{

 

  var cOpr = 'ckickLink';

  var ckicklink = document.getElementById('txtLinkA').value;

 

xmlHttp=GetXmlHttpObject();

if (xmlHttp==null)

{

alert ("Your browser does not support AJAX!");

return;

}

var url="php/linkkick.php";

url=url+"?Opr="+cOpr+"&linkick="+ckicklink;

xmlHttp.onreadystatechange=stateSearchResDet;

xmlHttp.open("GET",url,true);

xmlHttp.send(null);

}

function stateSearchResDet()

{

if (xmlHttp.readyState==2)

{

document.getElementById("lblStatusMsgKick").innerHTML="Processing.....";

}

else{}

 

if (xmlHttp.readyState==4)

{

 

 

if(xmlHttp.responseText == 0)

{

 

saveLinkKick();

}

else

{

//alert (xmlHttp.responseText);

document.getElementById("lblStatusMsgKick").innerHTML="Your Submitted Link Already Exists";

alert ("Your Submitted Link Already Exists, Thank You For Your Submission");

document.getElementById("lblStatusMsgKick").innerHTML= "";

clearAll();

}

 

}

else{}

}

//////////////

 

 

 

///////////////////

function saveLinkKick()

{

 

var sOpr = 'saveKick';

var slinkA = document.getElementById('txtLinkA').value;

 

xmlHttp=GetXmlHttpObject();

if (xmlHttp==null)

{

alert ("Your browser does not support AJAX!");

return;

}

var url="php/linkkick.php";

url=url+"?Opr="+sOpr+"&linkick="+slinkA;

xmlHttp.onreadystatechange=stateChangedstudDet;

xmlHttp.open("GET",url,true);

xmlHttp.send(null);

 

 

function stateChangedstudDet()

{

if (xmlHttp.readyState==2)

{

document.getElementById("lblStatusMsgKick").innerHTML="Processing.....";

}

else{}

 

if (xmlHttp.readyState==4)

{

document.getElementById('lblStatusMsgUnion').innerHTML="";

document.getElementById('lblStatusSnipper').innerHTML="";

document.getElementById('lblStatusChrist').innerHTML="";

document.getElementById("lblStatusMsgKick").innerHTML=xmlHttp.responseText;

clearAll();

}

else{}

}

}

////////////////////

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.