Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 13th, 2007, 04:32 PM
Registered User
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to RJ2001 Send a message via AIM to RJ2001 Send a message via MSN to RJ2001 Send a message via Yahoo to RJ2001
Default how do you assign php to a row value in javascript

How can I make the tempInput.value set to the php echo statement. I am storing each value in a session, but when I do it this way or using setAttribute(), it only places the php statement directly in the input box.

This is the code I am using:


function HDonCallReport_addCallsRecieved()


     var tbody = document.getElementById('CallsReceived').getElementsByTagName("TBODY")[0];

     var row = document.createElement("TR"); // create a new table row

     var td = new Array(4); // counting the table we made there are 8 cells per table row

     var tempSelect;

     var tempInput;

     var rownum = tbody.rows.length; // not +1 because we have a header row


     // Create Time select box

     td[0] = document.createElement("TD"); // create a td element     

     tempInput = document.createElement("INPUT"); // create an input

     tempInput.name = "Time_" + rownum; // name the input

     tempInput.id = "Time_" + rownum; // give an id to the input

     tempInput.size = 20; // set the size of the input

     tempInput.value="<?php echo htmlentities($_POST['Time_']); ?>";

     tempInput.onblur = "validateTimePicker(this)";

     td[0].appendChild(tempInput); // add the select box to the table cell


     // Create Location input

     td[1] = document.createElement("TD"); // create a table cell

     tempInput = document.createElement("INPUT"); // create an input

     tempInput.name = "Location_" + rownum; // name the input

     tempInput.id = "Location_" + rownum; // give an id to the input

     tempInput.size = 30; // set the size of the input

     td[1].appendChild(tempInput); // add the input to the table cell


     // Create Who Called input

     td[2] = document.createElement("TD");

     tempInput = document.createElement("INPUT");

     tempInput.name = "WhoCalled_" + rownum;

     tempInput.id = "WhoCalled_" + rownum;

     tempInput.size = 30;



     // Create Response input

     td[3] = document.createElement("TD");

     tempInput = document.createElement("textarea");

     tempInput.name = "Response_" + rownum;

     tempInput.id = "Response_" + rownum; 

     tempInput.rows = 2;

     tempInput.cols = 30;




     // Append each cell to the row we created row

     for(i=0; i<4; i++)


     // Append row to table so that it appears on screen



     // Increment the number of Code rows

     document.CallsReceived.CodeCount1.value = parseInt(document.witness.CodeCount1.value) + 1;


and this is what I want



<td >

<input id="Time_1" name="Time_1" size="20" value="<?php echo htmlentities($_POST['Time_1']); ?>" onblur="validateTimePicker(this)" />

<img src="gif/timepicker.gif" align="top" onclick="selectTime(this,Time_1);" STYLE="cursor:hand" />


Similar Threads
Thread Thread Starter Forum Replies Last Post
assign javascript variable to asp variable manjunath_c_k Classic ASP Basics 1 September 14th, 2006 07:35 AM
How To Assign Value To Session Using Javascript janice.koay Classic ASP Professional 1 May 9th, 2006 12:59 AM
How can i delete multiple row through PHP coding taha_elearner PHP Databases 1 October 28th, 2005 05:33 AM
How to assign javascript to Java? salahu Pro JSP 1 August 8th, 2005 03:05 PM
How to assign javascript value to java? salahu JSP Basics 1 June 27th, 2005 03:34 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.