Can you do this with PHP?

This is a discussion on Can you do this with PHP? within the PHP Language forums, part of the PHP Programming Forums category; Hi, We have some scripts here where we use some AJAX to populate some of the page. Basically the AJAX ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-21-2008
art@unsu.com
 
Posts: n/a
Default Can you do this with PHP?


Hi,

We have some scripts here where we use some AJAX to populate some of
the page.

Basically the AJAX routine calls a PHP script. That PHP script uses a
bunch of ECHO statements to create the page. Then, we use the
innerHTML to populate the section on the page.

The problem is, we have a small javascript routine in the middile of
the page which MUST be located there. It cannot be in the head.

If this is straight HTML, it works fine. But, if we use the PHP to
echo everything and then set the innerHTML, it does not work.

Is there any way to perform this? Basically use PHP to output a small
inline <SCRIPT> routine, and have it execute?

Thank you!
Reply With Quote
  #2 (permalink)  
Old 05-21-2008
sheldonlg
 
Posts: n/a
Default Re: Can you do this with PHP?

art@unsu.com wrote:
> Hi,
>
> We have some scripts here where we use some AJAX to populate some of
> the page.
>
> Basically the AJAX routine calls a PHP script. That PHP script uses a
> bunch of ECHO statements to create the page. Then, we use the
> innerHTML to populate the section on the page.
>
> The problem is, we have a small javascript routine in the middile of
> the page which MUST be located there. It cannot be in the head.
>
> If this is straight HTML, it works fine. But, if we use the PHP to
> echo everything and then set the innerHTML, it does not work.
>
> Is there any way to perform this? Basically use PHP to output a small
> inline <SCRIPT> routine, and have it execute?
>
> Thank you!


Yes. Put a <div id="blah"> surrounding that block. Mow make the target
of the Javascript innerHTML be for that div, "blah". You can position
the "blah" wherever you want.

Now, when you say in the middle of the page, do you mean that it is some
fixed position relative to what is above? Or, do you mean that it is in
the middle of the screen regardless of how you scroll the stuff behind.
The latter is handles (except IE6) with position: fixed. There are
workarounds for IE6 having to do with overflow. If you mean the latter,
that is handled with position: relative and position: fixed.

By the way, I would use print rather than echo and use an ob_start to
gather it all before closing in and writing it.
Reply With Quote
  #3 (permalink)  
Old 05-21-2008
Álvaro G. Vicario
 
Posts: n/a
Default Re: Can you do this with PHP?

art@unsu.com escribió:
> The problem is, we have a small javascript routine in the middile of
> the page which MUST be located there. It cannot be in the head.


You'd be surprised to learn how far non-obtrusive JS can reach ;-)

> If this is straight HTML, it works fine. But, if we use the PHP to
> echo everything and then set the innerHTML, it does not work.
>
> Is there any way to perform this? Basically use PHP to output a small
> inline <SCRIPT> routine, and have it execute?


There's nothing wrong with PHP. The issue is in your JavaScript AJAX
routine. The <script> tags inserted with innerHTML won't get executed in
most browsers (bug or feature, I don't know). An example:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head><title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript"><!--
function appendFoo(where){
where.innerHTML += ' Static foo <script
type="text/javascript">document.write("Dynamic foo");<\/script><\/div>';
}
//--></script>
</head>
<body>

<p>Static foo <script type="text/javascript">document.write("Dynamic
foo");</script></p>
<p onclick="appendFoo(this)">Click me</p>

</body>
</html>

I suggest rethink your JavaScript code.


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Reply With Quote
  #4 (permalink)  
Old 05-21-2008
art@unsu.com
 
Posts: n/a
Default Re: Can you do this with PHP?

On May 21, 11:30 am, sheldonlg <sheldonlg> wrote:
> a...@unsu.com wrote:
> > Hi,

>
> > We have some scripts here where we use some AJAX to populate some of
> > the page.

>
> > Basically the AJAX routine calls a PHP script. That PHP script uses a
> > bunch of ECHO statements to create the page. Then, we use the
> > innerHTML to populate the section on the page.

>
> > The problem is, we have a small javascript routine in the middile of
> > the page which MUST be located there. It cannot be in the head.

>
> > If this is straight HTML, it works fine. But, if we use the PHP to
> > echo everything and then set the innerHTML, it does not work.

>
> > Is there any way to perform this? Basically use PHP to output a small
> > inline <SCRIPT> routine, and have it execute?

>
> > Thank you!

>
> Yes. Put a <div id="blah"> surrounding that block. Mow make the target
> of the Javascript innerHTML be for that div, "blah". You can position
> the "blah" wherever you want.
>
> Now, when you say in the middle of the page, do you mean that it is some
> fixed position relative to what is above? Or, do you mean that it is in
> the middle of the screen regardless of how you scroll the stuff behind.
> The latter is handles (except IE6) with position: fixed. There are
> workarounds for IE6 having to do with overflow. If you mean the latter,
> that is handled with position: relative and position: fixed.
>
> By the way, I would use print rather than echo and use an ob_start to
> gather it all before closing in and writing it.



Thanks for the reply. My explanation may be a bit convoluted, so,
I'll try my best to explain it.

We are trying to use AJAX and XML to populate the page. Our PHP
script selects data from the database, returns the data to the calling
Javascript routine and sets innerHTML by concatenating a long string
like this:

str = '<table>';
str = str + '<TR>';
str = str + '<TD>';
str = str + '<INPUT TYPE=text NAME=CustName ID=CustName SIZE=25
MAXLENGTH=25 VALUE="' + getElementTextNS("", "Name", r[i], 0)

So, we create each <DIV> like that and then set innerHTML. Probably
not the best way, but it works fine. There is also a javascript
calendar on the page. We populate the text box associated with the
calendar with data from the AJAX routine using the following line
though it is a bit more involved:

document.Detail_Screen.EnterDate.value=getElementT extNS("",
"entered_date", r[i], 0);

The javascript is in a <DIV> which is in the normal HTML document and
works fine. No problems.


The real issue is that our page has 3 combo boxes on it. We need to
populate the combo boxes with values and the selected value should
match what the value is in the database record that is being
displayed. We do not want to hard code all the combo box values.

So, how do we select all the values from the database that belong in
the combo box and return them using AJAX? One of the boxes has 40
options in it. We do not want to hard code 40 items.

Because we did not know how to do that, we made our second attempt,
which was to let the PHP script create the page via echo statements.
The problem there is that the inline javascript routine is not
executing. And, since we need to put the date value in the text box,
how can we access that value? The text box is on the HTML side, and
the PHP is on the server side.


So in summary, we would like to use AJAX & XML. But, we do not know
how to populate the combo boxes with values and be able to choose the
selected value without returning 40 fields from the database. That is
not a good plan.

If we use the PHP method, then how do we access the date value so we
can put it into the calendar text box? The page would be drawn on the
PHP side. Since the calendar is on the HTML side, we cannot access it
from the server....

Does it all make sense? Do you see our problem? If not let me know
and I can try to explain more.

Thank you!



Reply With Quote
  #5 (permalink)  
Old 05-21-2008
sheldonlg
 
Posts: n/a
Default Re: Can you do this with PHP?

art@unsu.com wrote:
> On May 21, 11:30 am, sheldonlg <sheldonlg> wrote:
>> a...@unsu.com wrote:
>>> Hi,
>>> We have some scripts here where we use some AJAX to populate some of
>>> the page.
>>> Basically the AJAX routine calls a PHP script. That PHP script uses a
>>> bunch of ECHO statements to create the page. Then, we use the
>>> innerHTML to populate the section on the page.
>>> The problem is, we have a small javascript routine in the middile of
>>> the page which MUST be located there. It cannot be in the head.
>>> If this is straight HTML, it works fine. But, if we use the PHP to
>>> echo everything and then set the innerHTML, it does not work.
>>> Is there any way to perform this? Basically use PHP to output a small
>>> inline <SCRIPT> routine, and have it execute?
>>> Thank you!

>> Yes. Put a <div id="blah"> surrounding that block. Mow make the target
>> of the Javascript innerHTML be for that div, "blah". You can position
>> the "blah" wherever you want.
>>
>> Now, when you say in the middle of the page, do you mean that it is some
>> fixed position relative to what is above? Or, do you mean that it is in
>> the middle of the screen regardless of how you scroll the stuff behind.
>> The latter is handles (except IE6) with position: fixed. There are
>> workarounds for IE6 having to do with overflow. If you mean the latter,
>> that is handled with position: relative and position: fixed.
>>
>> By the way, I would use print rather than echo and use an ob_start to
>> gather it all before closing in and writing it.

>
>


You lost me at "hello". (to paraphrase and twist Jerry McGuire). I'll
try, though.


> Thanks for the reply. My explanation may be a bit convoluted, so,
> I'll try my best to explain it.
>
> We are trying to use AJAX and XML to populate the page. Our PHP
> script selects data from the database, returns the data to the calling
> Javascript routine and sets innerHTML by concatenating a long string
> like this:
>
> str = '<table>';
> str = str + '<TR>';
> str = str + '<TD>';
> str = str + '<INPUT TYPE=text NAME=CustName ID=CustName SIZE=25
> MAXLENGTH=25 VALUE="' + getElementTextNS("", "Name", r[i], 0)


OK so far. (assuming you also close tags properly)

>
> So, we create each <DIV> like that and then set innerHTML. Probably
> not the best way, but it works fine. There is also a javascript


Why not?

> calendar on the page. We populate the text box associated with the
> calendar with data from the AJAX routine using the following line
> though it is a bit more involved:
>
> document.Detail_Screen.EnterDate.value=getElementT extNS("",
> "entered_date", r[i], 0);
>
> The javascript is in a <DIV> which is in the normal HTML document and
> works fine. No problems.


Fine.

>
>
> The real issue is that our page has 3 combo boxes on it. We need to
> populate the combo boxes with values and the selected value should
> match what the value is in the database record that is being
> displayed. We do not want to hard code all the combo box values.


Watcha mean by "combo box". I have seen controls for dropdown lists
with multiple lines and I have seen text entries, but I have not seen a
combo box control that combines the two. (It would be nice, though, as
it enables the user to enter a value not on the list).

>
> So, how do we select all the values from the database that belong in
> the combo box and return them using AJAX? One of the boxes has 40
> options in it. We do not want to hard code 40 items.


By a mysql query? There has to be something constraining in the where
clause. You haven't said what. Once you do the proper query, you can
build the select list string and use that for the innerHTML.

>
> Because we did not know how to do that, we made our second attempt,
> which was to let the PHP script create the page via echo statements.


Oh, I see. You didn't want to put all those values in raw HTML. OK.

> The problem there is that the inline javascript routine is not
> executing. And, since we need to put the date value in the text box,


Why is it not executing. I have an AJAX application that builds an area
via AJAX with innerHTML and it calls javascripts when clicked. The only
prerequisite is that the javascript be in place at load time. I
accomplish this by loading the library when I call that page.

> how can we access that value? The text box is on the HTML side, and
> the PHP is on the server side.


What is the problem here? In the javascript that invokes the AJAX you have
var dateVal = getElementByID('id of the date text box').value;

You can create an object with
var obj = new Object();
and have obj.dateVal = dateVal;

You then pass that with the call to your AJAX and decipher it at the php
side.
>
>
> So in summary, we would like to use AJAX & XML. But, we do not know
> how to populate the combo boxes with values and be able to choose the
> selected value without returning 40 fields from the database. That is
> not a good plan.


I don't understand this.

>
> If we use the PHP method, then how do we access the date value so we
> can put it into the calendar text box? The page would be drawn on the
> PHP side. Since the calendar is on the HTML side, we cannot access it


The page is NEVER **drawn** on the php (server) side. It is ALWAYS
**drawn** on the HTML (client) side. You can compose a string on the
php side, but it is not drawn there.

> from the server....


You access it on the client, add the parameter into an object's field
and pass that to the server where it is deciphered. Clients side does
client things and server side does server things. They communicate, in
this case, with the AJAX calls and objects that are passed.

>
> Does it all make sense? Do you see our problem? If not let me know
> and I can try to explain more.


I think I understand you now. You, apparantly, don't know how to pass
parameters from the client to server via AJAX. Learn that and your
problems should be 99% solved.

>
> Thank you!


You're welcome. (Been in your shoes many times myself.) Hope this
helped you.


Reply With Quote
  #6 (permalink)  
Old 05-21-2008
art@unsu.com
 
Posts: n/a
Default Re: Can you do this with PHP?

On May 21, 1:43 pm, sheldonlg <sheldonlg> wrote:
> a...@unsu.com wrote:
> > On May 21, 11:30 am, sheldonlg <sheldonlg> wrote:
> >> a...@unsu.com wrote:
> >>> Hi,
> >>> We have some scripts here where we use some AJAX to populate some of
> >>> the page.
> >>> Basically the AJAX routine calls a PHP script. That PHP script uses a
> >>> bunch of ECHO statements to create the page. Then, we use the
> >>> innerHTML to populate the section on the page.
> >>> The problem is, we have a small javascript routine in the middile of
> >>> the page which MUST be located there. It cannot be in the head.
> >>> If this is straight HTML, it works fine. But, if we use the PHP to
> >>> echo everything and then set the innerHTML, it does not work.
> >>> Is there any way to perform this? Basically use PHP to output a small
> >>> inline <SCRIPT> routine, and have it execute?
> >>> Thank you!
> >> Yes. Put a <div id="blah"> surrounding that block. Mow make the target
> >> of the Javascript innerHTML be for that div, "blah". You can position
> >> the "blah" wherever you want.

>
> >> Now, when you say in the middle of the page, do you mean that it is some
> >> fixed position relative to what is above? Or, do you mean that it is in
> >> the middle of the screen regardless of how you scroll the stuff behind.
> >> The latter is handles (except IE6) with position: fixed. There are
> >> workarounds for IE6 having to do with overflow. If you mean the latter,
> >> that is handled with position: relative and position: fixed.

>
> >> By the way, I would use print rather than echo and use an ob_start to
> >> gather it all before closing in and writing it.

>
> You lost me at "hello". (to paraphrase and twist Jerry McGuire). I'll
> try, though.
>
> > Thanks for the reply. My explanation may be a bit convoluted, so,
> > I'll try my best to explain it.

>
> > We are trying to use AJAX and XML to populate the page. Our PHP
> > script selects data from the database, returns the data to the calling
> > Javascript routine and sets innerHTML by concatenating a long string
> > like this:

>
> > str = '<table>';
> > str = str + '<TR>';
> > str = str + '<TD>';
> > str = str + '<INPUT TYPE=text NAME=CustName ID=CustName SIZE=25
> > MAXLENGTH=25 VALUE="' + getElementTextNS("", "Name", r[i], 0)

>
> OK so far. (assuming you also close tags properly)
>
>
>
> > So, we create each <DIV> like that and then set innerHTML. Probably
> > not the best way, but it works fine. There is also a javascript

>
> Why not?
>
> > calendar on the page. We populate the text box associated with the
> > calendar with data from the AJAX routine using the following line
> > though it is a bit more involved:

>
> > document.Detail_Screen.EnterDate.value=getElementT extNS("",
> > "entered_date", r[i], 0);

>
> > The javascript is in a <DIV> which is in the normal HTML document and
> > works fine. No problems.

>
> Fine.
>
>
>
> > The real issue is that our page has 3 combo boxes on it. We need to
> > populate the combo boxes with values and the selected value should
> > match what the value is in the database record that is being
> > displayed. We do not want to hard code all the combo box values.

>
> Watcha mean by "combo box". I have seen controls for dropdown lists
> with multiple lines and I have seen text entries, but I have not seen a
> combo box control that combines the two. (It would be nice, though, as
> it enables the user to enter a value not on the list).
>
>
>
> > So, how do we select all the values from the database that belong in
> > the combo box and return them using AJAX? One of the boxes has 40
> > options in it. We do not want to hard code 40 items.

>
> By a mysql query? There has to be something constraining in the where
> clause. You haven't said what. Once you do the proper query, you can
> build the select list string and use that for the innerHTML.
>
>
>
> > Because we did not know how to do that, we made our second attempt,
> > which was to let the PHP script create the page via echo statements.

>
> Oh, I see. You didn't want to put all those values in raw HTML. OK.
>
> > The problem there is that the inline javascript routine is not
> > executing. And, since we need to put the date value in the text box,

>
> Why is it not executing. I have an AJAX application that builds an area
> via AJAX with innerHTML and it calls javascripts when clicked. The only
> prerequisite is that the javascript be in place at load time. I
> accomplish this by loading the library when I call that page.
>
> > how can we access that value? The text box is on the HTML side, and
> > the PHP is on the server side.

>
> What is the problem here? In the javascript that invokes the AJAX you have
> var dateVal = getElementByID('id of the date text box').value;
>
> You can create an object with
> var obj = new Object();
> and have obj.dateVal = dateVal;
>
> You then pass that with the call to your AJAX and decipher it at the php
> side.
>
>
>
> > So in summary, we would like to use AJAX & XML. But, we do not know
> > how to populate the combo boxes with values and be able to choose the
> > selected value without returning 40 fields from the database. That is
> > not a good plan.

>
> I don't understand this.
>
>
>
> > If we use the PHP method, then how do we access the date value so we
> > can put it into the calendar text box? The page would be drawn on the
> > PHP side. Since the calendar is on the HTML side, we cannot access it

>
> The page is NEVER **drawn** on the php (server) side. It is ALWAYS
> **drawn** on the HTML (client) side. You can compose a string on the
> php side, but it is not drawn there.
>
> > from the server....

>
> You access it on the client, add the parameter into an object's field
> and pass that to the server where it is deciphered. Clients side does
> client things and server side does server things. They communicate, in
> this case, with the AJAX calls and objects that are passed.
>
>
>
> > Does it all make sense? Do you see our problem? If not let me know
> > and I can try to explain more.

>
> I think I understand you now. You, apparantly, don't know how to pass
> parameters from the client to server via AJAX. Learn that and your
> problems should be 99% solved.
>
>
>
> > Thank you!

>
> You're welcome. (Been in your shoes many times myself.) Hope this
> helped you.


I'll try and implement some of your suggestions.

Combo box - yes, I meant drop down list.

I guess I'll need another AJAX function to get the values for the drop
down list. I'll what I can do. Normally I'm an Oracle DBA, so, this
is a bit out of context for me......

Reply With Quote
  #7 (permalink)  
Old 05-21-2008
sheldonlg
 
Posts: n/a
Default Re: Can you do this with PHP?

art@unsu.com wrote:
> On May 21, 1:43 pm, sheldonlg <sheldonlg> wrote:
>> a...@unsu.com wrote:
>>> On May 21, 11:30 am, sheldonlg <sheldonlg> wrote:
>>>> a...@unsu.com wrote:
>>>>> Hi,
>>>>> We have some scripts here where we use some AJAX to populate some of
>>>>> the page.
>>>>> Basically the AJAX routine calls a PHP script. That PHP script uses a
>>>>> bunch of ECHO statements to create the page. Then, we use the
>>>>> innerHTML to populate the section on the page.
>>>>> The problem is, we have a small javascript routine in the middile of
>>>>> the page which MUST be located there. It cannot be in the head.
>>>>> If this is straight HTML, it works fine. But, if we use the PHP to
>>>>> echo everything and then set the innerHTML, it does not work.
>>>>> Is there any way to perform this? Basically use PHP to output a small
>>>>> inline <SCRIPT> routine, and have it execute?
>>>>> Thank you!
>>>> Yes. Put a <div id="blah"> surrounding that block. Mow make the target
>>>> of the Javascript innerHTML be for that div, "blah". You can position
>>>> the "blah" wherever you want.
>>>> Now, when you say in the middle of the page, do you mean that it is some
>>>> fixed position relative to what is above? Or, do you mean that it is in
>>>> the middle of the screen regardless of how you scroll the stuff behind.
>>>> The latter is handles (except IE6) with position: fixed. There are
>>>> workarounds for IE6 having to do with overflow. If you mean the latter,
>>>> that is handled with position: relative and position: fixed.
>>>> By the way, I would use print rather than echo and use an ob_start to
>>>> gather it all before closing in and writing it.

>> You lost me at "hello". (to paraphrase and twist Jerry McGuire). I'll
>> try, though.
>>
>>> Thanks for the reply. My explanation may be a bit convoluted, so,
>>> I'll try my best to explain it.
>>> We are trying to use AJAX and XML to populate the page. Our PHP
>>> script selects data from the database, returns the data to the calling
>>> Javascript routine and sets innerHTML by concatenating a long string
>>> like this:
>>> str = '<table>';
>>> str = str + '<TR>';
>>> str = str + '<TD>';
>>> str = str + '<INPUT TYPE=text NAME=CustName ID=CustName SIZE=25
>>> MAXLENGTH=25 VALUE="' + getElementTextNS("", "Name", r[i], 0)

>> OK so far. (assuming you also close tags properly)
>>
>>
>>
>>> So, we create each <DIV> like that and then set innerHTML. Probably
>>> not the best way, but it works fine. There is also a javascript

>> Why not?
>>
>>> calendar on the page. We populate the text box associated with the
>>> calendar with data from the AJAX routine using the following line
>>> though it is a bit more involved:
>>> document.Detail_Screen.EnterDate.value=getElementT extNS("",
>>> "entered_date", r[i], 0);
>>> The javascript is in a <DIV> which is in the normal HTML document and
>>> works fine. No problems.

>> Fine.
>>
>>
>>
>>> The real issue is that our page has 3 combo boxes on it. We need to
>>> populate the combo boxes with values and the selected value should
>>> match what the value is in the database record that is being
>>> displayed. We do not want to hard code all the combo box values.

>> Watcha mean by "combo box". I have seen controls for dropdown lists
>> with multiple lines and I have seen text entries, but I have not seen a
>> combo box control that combines the two. (It would be nice, though, as
>> it enables the user to enter a value not on the list).
>>
>>
>>
>>> So, how do we select all the values from the database that belong in
>>> the combo box and return them using AJAX? One of the boxes has 40
>>> options in it. We do not want to hard code 40 items.

>> By a mysql query? There has to be something constraining in the where
>> clause. You haven't said what. Once you do the proper query, you can
>> build the select list string and use that for the innerHTML.
>>
>>
>>
>>> Because we did not know how to do that, we made our second attempt,
>>> which was to let the PHP script create the page via echo statements.

>> Oh, I see. You didn't want to put all those values in raw HTML. OK.
>>
>>> The problem there is that the inline javascript routine is not
>>> executing. And, since we need to put the date value in the text box,

>> Why is it not executing. I have an AJAX application that builds an area
>> via AJAX with innerHTML and it calls javascripts when clicked. The only
>> prerequisite is that the javascript be in place at load time. I
>> accomplish this by loading the library when I call that page.
>>
>>> how can we access that value? The text box is on the HTML side, and
>>> the PHP is on the server side.

>> What is the problem here? In the javascript that invokes the AJAX you have
>> var dateVal = getElementByID('id of the date text box').value;
>>
>> You can create an object with
>> var obj = new Object();
>> and have obj.dateVal = dateVal;
>>
>> You then pass that with the call to your AJAX and decipher it at the php
>> side.
>>
>>
>>
>>> So in summary, we would like to use AJAX & XML. But, we do not know
>>> how to populate the combo boxes with values and be able to choose the
>>> selected value without returning 40 fields from the database. That is
>>> not a good plan.

>> I don't understand this.
>>
>>
>>
>>> If we use the PHP method, then how do we access the date value so we
>>> can put it into the calendar text box? The page would be drawn on the
>>> PHP side. Since the calendar is on the HTML side, we cannot access it

>> The page is NEVER **drawn** on the php (server) side. It is ALWAYS
>> **drawn** on the HTML (client) side. You can compose a string on the
>> php side, but it is not drawn there.
>>
>>> from the server....

>> You access it on the client, add the parameter into an object's field
>> and pass that to the server where it is deciphered. Clients side does
>> client things and server side does server things. They communicate, in
>> this case, with the AJAX calls and objects that are passed.
>>
>>
>>
>>> Does it all make sense? Do you see our problem? If not let me know
>>> and I can try to explain more.

>> I think I understand you now. You, apparantly, don't know how to pass
>> parameters from the client to server via AJAX. Learn that and your
>> problems should be 99% solved.
>>
>>
>>
>>> Thank you!

>> You're welcome. (Been in your shoes many times myself.) Hope this
>> helped you.

>
> I'll try and implement some of your suggestions.
>
> Combo box - yes, I meant drop down list.
>
> I guess I'll need another AJAX function to get the values for the drop
> down list. I'll what I can do. Normally I'm an Oracle DBA, so, this
> is a bit out of context for me......


No, it is just another dba call. Then in php you build the option list
with

$resultOfQuery = mysql_query($query_string);
while ($row=mysql_fetch_assoc($resultOfQuery)) {
$str .= '<option value="' . $row['fieldname'] . '">'
. $row['fieldname'] . '</option>';
}

You could also build the select statement around it. This, then, gets
targeted at the appropriate id. If the select has the id, then just
build the options. If it is in something else, then build the whole thing.
Reply With Quote
  #8 (permalink)  
Old 05-21-2008
Paul Lautman
 
Posts: n/a
Default Re: Can you do this with PHP?

sheldonlg wrote:
> By the way, I would use print rather than echo

I am intrigued. What is it about print that in your opinion makes it more
suitable in this particular case?


Reply With Quote
  #9 (permalink)  
Old 05-22-2008
sheldonlg
 
Posts: n/a
Default Re: Can you do this with PHP?

Paul Lautman wrote:
> sheldonlg wrote:
>> By the way, I would use print rather than echo

> I am intrigued. What is it about print that in your opinion makes it more
> suitable in this particular case?
>
>


Just habit, I guess, and similarity to other languages. For a short
discussion of the differences, which are very minor, see
http://www.faqts.com/knowledge_base/...l/aid/1/fid/40
Reply With Quote
  #10 (permalink)  
Old 05-22-2008
art@unsu.com
 
Posts: n/a
Default Re: Can you do this with PHP?

On May 22, 6:55 am, sheldonlg <sheldonlg> wrote:
> Paul Lautman wrote:
> > sheldonlg wrote:
> >> By the way, I would use print rather than echo

> > I am intrigued. What is it about print that in your opinion makes it more
> > suitable in this particular case?

>
> Just habit, I guess, and similarity to other languages. For a short
> discussion of the differences, which are very minor, seehttp://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40


Well, we're using AJAX here. I guess I can create another routine to
get the data from the database and parse it when it comes back to thr
javascript routine......


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:02 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0