Hello list
This question has probably already been asked, but let me ask again
I have a mysql database to which I connect with my php scripts. The
database contains articles. Name, Unit_Price and Reference
Now my client needs to order 5 items, click a button and a table with 5
lines and 3 columns appears (until now easy)
In the first column is a drop down box with a <select > and <options> in
which I store all possible names.
I would like than whenever the client changes one of the boxes (in my
case there are 5) the Unite_Price column and Reference column in the
line he just choose get automatically updated
I search all over the web but I could not find it.
Thank you for your help
Alex 19 3850
Alex wrote: Hello list
This question has probably already been asked, but let me ask again
I have a mysql database to which I connect with my php scripts. The database contains articles. Name, Unit_Price and Reference
Now my client needs to order 5 items, click a button and a table with 5 lines and 3 columns appears (until now easy)
In the first column is a drop down box with a <select > and <options> in which I store all possible names.
I would like than whenever the client changes one of the boxes (in my case there are 5) the Unite_Price column and Reference column in the line he just choose get automatically updated
Are you talking about Javascript here?
Do you want the user to do a select on your page and the page will fill the
appropriate fields? Then go Javascript.
Or do you want to go back to the server if somebody touches the selectbox?
Then it is PHP.
I think you better do this with Javascript.
Try comp.lang.javascript.
If you want to do it in PHP, well... where to start?
Do you know how to receive a form in PHP? ($_POST[] and the like)
Do you know how to put dynamical data into your html-page with PHP?
If you want to do this in PHP, please be more specific and ask a question
that is answerable instead of the complete solution to a problem nobody in
here knows except you. :-) I search all over the web but I could not find it.
Really?
This is quite basic stuff (both in Javascript and PHP) so I wonder why you
didn't find any code that does similar things.
(No punch intended)
Good luck.
Regards,
Erwin Moller Thank you for your help
Alex
Erwin Moller wrote: Alex wrote:
Hello list
This question has probably already been asked, but let me ask again
I have a mysql database to which I connect with my php scripts. The database contains articles. Name, Unit_Price and Reference
Now my client needs to order 5 items, click a button and a table with 5 lines and 3 columns appears (until now easy)
In the first column is a drop down box with a <select > and <options> in which I store all possible names.
I would like than whenever the client changes one of the boxes (in my case there are 5) the Unite_Price column and Reference column in the line he just choose get automatically updated
Are you talking about Javascript here? Do you want the user to do a select on your page and the page will fill the appropriate fields? Then go Javascript.
Or do you want to go back to the server if somebody touches the selectbox? Then it is PHP.
I think you better do this with Javascript. Try comp.lang.javascript.
If you want to do it in PHP, well... where to start? Do you know how to receive a form in PHP? ($_POST[] and the like) Do you know how to put dynamical data into your html-page with PHP?
If you want to do this in PHP, please be more specific and ask a question that is answerable instead of the complete solution to a problem nobody in here knows except you. :-)
I search all over the web but I could not find it.
Really? This is quite basic stuff (both in Javascript and PHP) so I wonder why you didn't find any code that does similar things. (No punch intended)
Good luck.
Regards, Erwin Moller
Thank you for your help
Alex
Well you are almost right, this is not only php it is also a bit of
Javascript, I need in fact to be able to pass the
$fields=mysql_fetch_object($dataresults} to a javascript, but I do not
see how I can implement that since I do not know how to pass the result
using php, so in that sens it is also php relevant
as for the punch, I searched the net but I only get either trivial
results or things that populate a drop down menu (which I already know
how to do) That's why I ask it here
Thanks
Krustov wrote: <comp.lang.php , Erwin Moller , si**********************************...y ourself.com> <43***********************@news.xs4all.nl> <Wed, 22 Feb 2006 16:46:51 +0100>
> I search all over the web but I could not find it.
Really? This is quite basic stuff (both in Javascript and PHP) so I wonder why you didn't find any code that does similar things. (No punch intended)
Do you ever actually help anybody on here who asks a question .
You only ever seem to comment and give your opinion on 'what' they ask rather than helping them .
Bull. Look around more.
I do actually help people, even this OP, as you could see in the part you
cutted away. Please go insult somebody else, thanks.
Erwin Moller
Alex wrote: Erwin Moller wrote:
Alex wrote:
Hello list
This question has probably already been asked, but let me ask again
I have a mysql database to which I connect with my php scripts. The database contains articles. Name, Unit_Price and Reference
Now my client needs to order 5 items, click a button and a table with 5 lines and 3 columns appears (until now easy)
In the first column is a drop down box with a <select > and <options> in which I store all possible names.
I would like than whenever the client changes one of the boxes (in my case there are 5) the Unite_Price column and Reference column in the line he just choose get automatically updated
Are you talking about Javascript here? Do you want the user to do a select on your page and the page will fill the appropriate fields? Then go Javascript.
Or do you want to go back to the server if somebody touches the selectbox? Then it is PHP.
I think you better do this with Javascript. Try comp.lang.javascript.
If you want to do it in PHP, well... where to start? Do you know how to receive a form in PHP? ($_POST[] and the like) Do you know how to put dynamical data into your html-page with PHP?
If you want to do this in PHP, please be more specific and ask a question that is answerable instead of the complete solution to a problem nobody in here knows except you. :-) I search all over the web but I could not find it.
Really? This is quite basic stuff (both in Javascript and PHP) so I wonder why you didn't find any code that does similar things. (No punch intended)
Good luck.
Regards, Erwin Moller
Thank you for your help
Alex Well you are almost right, this is not only php it is also a bit of Javascript, I need in fact to be able to pass the $fields=mysql_fetch_object($dataresults} to a javascript, but I do not see how I can implement that since I do not know how to pass the result using php, so in that sens it is also php relevant
creating a javascript portion of a page and populating it with the data
from $fields is no different than creating the select/options from a
resultset.
Spend some time to map out your data flow. where does it come from
(server-side database, client-side selection/entry), where does it go
browser/client,server into database or other processing.
as for the punch, I searched the net but I only get either trivial results or things that populate a drop down menu (which I already know how to do) That's why I ask it here
Understanding the data flow above allows you to be a good programmer not
just a copy/paster (while that is not bad, you should not rely on it).
One should also understand the technologies they are using and why they
are using them - there may be other solutions to your problem you/we
have not thought of...
Thanks
Krustov wrote: <comp.lang.php , Erwin Moller , si**********************************...y ourself.com> <43***********************@news.xs4all.nl> <Wed, 22 Feb 2006 16:46:51 +0100>
I search all over the web but I could not find it.
Really? This is quite basic stuff (both in Javascript and PHP) so I wonder why you didn't find any code that does similar things. (No punch intended)
Do you ever actually help anybody on here who asks a question .
You only ever seem to comment and give your opinion on 'what' they ask rather than helping them .
Krustov,
did you ever think that by forcing someone back to the docs or other
research DOES help them to better understand what it is they are trying
to accomplish and maybe - just maybe - learn a lot more than they would
if we just gave some code snippet? (BTW I have seen WAY TOO MANY
questions in some forums that are trying to solve almost an identical
problem - and some in those forums refuse to answer because it is common
knowledge they are trying to solve an assignment from their CIS/IT
professor in school. Solving the problem with a code snippet gains
nothing - understanding the technology gains much knowledge enabling
them to solve more and more complex isssues. Most programmers/IT
professionals are neither programmers or professional...)
I could go on a rant that describes how some generations feel they
"deserve" to be spoon-fed their entire life - but I do not believe this
situation warrants that much effort.
noone wrote: Krustov wrote: <comp.lang.php , Erwin Moller , si**********************************...y ourself.com> <43***********************@news.xs4all.nl> <Wed, 22 Feb 2006 16:46:51 +0100>
I search all over the web but I could not find it.
Really? This is quite basic stuff (both in Javascript and PHP) so I wonder why you didn't find any code that does similar things. (No punch intended)
Do you ever actually help anybody on here who asks a question .
You only ever seem to comment and give your opinion on 'what' they ask rather than helping them .
Krustov,
did you ever think that by forcing someone back to the docs or other research DOES help them to better understand what it is they are trying to accomplish and maybe - just maybe - learn a lot more than they would if we just gave some code snippet? (BTW I have seen WAY TOO MANY questions in some forums that are trying to solve almost an identical problem - and some in those forums refuse to answer because it is common knowledge they are trying to solve an assignment from their CIS/IT professor in school. Solving the problem with a code snippet gains nothing - understanding the technology gains much knowledge enabling them to solve more and more complex isssues. Most programmers/IT professionals are neither programmers or professional...)
I could go on a rant that describes how some generations feel they "deserve" to be spoon-fed their entire life - but I do not believe this situation warrants that much effort.
thx mate. :-)
Erwin
Alex wrote: Erwin Moller wrote: Alex wrote:
Hello list
This question has probably already been asked, but let me ask again
I have a mysql database to which I connect with my php scripts. The database contains articles. Name, Unit_Price and Reference
Now my client needs to order 5 items, click a button and a table with 5 lines and 3 columns appears (until now easy)
In the first column is a drop down box with a <select > and <options> in which I store all possible names.
I would like than whenever the client changes one of the boxes (in my case there are 5) the Unite_Price column and Reference column in the line he just choose get automatically updated
Are you talking about Javascript here? Do you want the user to do a select on your page and the page will fill the appropriate fields? Then go Javascript.
Or do you want to go back to the server if somebody touches the selectbox? Then it is PHP.
I think you better do this with Javascript. Try comp.lang.javascript.
If you want to do it in PHP, well... where to start? Do you know how to receive a form in PHP? ($_POST[] and the like) Do you know how to put dynamical data into your html-page with PHP?
If you want to do this in PHP, please be more specific and ask a question that is answerable instead of the complete solution to a problem nobody in here knows except you. :-)
I search all over the web but I could not find it.
Really? This is quite basic stuff (both in Javascript and PHP) so I wonder why you didn't find any code that does similar things. (No punch intended)
Good luck.
Regards, Erwin Moller
Thank you for your help
Alex Well you are almost right, this is not only php it is also a bit of Javascript, I need in fact to be able to pass the $fields=mysql_fetch_object($dataresults} to a javascript, but I do not see how I can implement that since I do not know how to pass the result using php, so in that sens it is also php relevant
as for the punch, I searched the net but I only get either trivial results or things that populate a drop down menu (which I already know how to do) That's why I ask it here
Thanks
Hi alex, just hang on.
I made something similar (databasemapping to JS) just one week back, and am
fitting it into an example that I will post soon.
Erwin
Alex wrote: Erwin Moller wrote: Alex wrote:
Hello list
This question has probably already been asked, but let me ask again
I have a mysql database to which I connect with my php scripts. The database contains articles. Name, Unit_Price and Reference
Now my client needs to order 5 items, click a button and a table with 5 lines and 3 columns appears (until now easy)
In the first column is a drop down box with a <select > and <options> in which I store all possible names.
I would like than whenever the client changes one of the boxes (in my case there are 5) the Unite_Price column and Reference column in the line he just choose get automatically updated
Are you talking about Javascript here? Do you want the user to do a select on your page and the page will fill the appropriate fields? Then go Javascript.
Or do you want to go back to the server if somebody touches the selectbox? Then it is PHP.
I think you better do this with Javascript. Try comp.lang.javascript.
If you want to do it in PHP, well... where to start? Do you know how to receive a form in PHP? ($_POST[] and the like) Do you know how to put dynamical data into your html-page with PHP?
If you want to do this in PHP, please be more specific and ask a question that is answerable instead of the complete solution to a problem nobody in here knows except you. :-)
I search all over the web but I could not find it.
Really? This is quite basic stuff (both in Javascript and PHP) so I wonder why you didn't find any code that does similar things. (No punch intended)
Good luck.
Regards, Erwin Moller
Thank you for your help
Alex Well you are almost right, this is not only php it is also a bit of Javascript, I need in fact to be able to pass the $fields=mysql_fetch_object($dataresults} to a javascript, but I do not see how I can implement that since I do not know how to pass the result using php, so in that sens it is also php relevant
Ok, clear.
So you need data from the database ready-at-hand in a webpage, usable for
javascript? Right?
Here follows a simple example, maybe enough to get you going in your own
situation.
Suppose you have 1 selectbox, and depending on the value the visitor selects
you need to populate a second selectbox.
eg:
[mainselectbox] category
[secondary selectbox] item
You can now simply fill the first selectbox with appropriate options. (You
said you already know how, so I skip that part)
Just add an eventhandler to the select, you'll end up with something like
this (just the html)
<select name="mainselectbox" onChange="populateSecondairy();">
Here follows a comple example.
I faked the queryresults to keep things shorter, but if you understand the
used Javascript, you are able to modify it for your own uses.
------------------------------
<?
// fakeresult from databasequery that returned category and items
$rs = array(
"fruit" => array("apple","banana","pineapple"),
"books" => array("HitchHikersGuideToTheGalaxy","Programming
Perl","Postgresql"),
"animals" => array("dog","cat")
);
?>
<html>
<head>
<title>test</title>
</head>
<body>
<form action="bla.php" Method="POST" name="testform">
category: <SELECT name="category" onChange="populateSecondSelect();">
<?
foreach($rs as $cat => $items){
?>
<OPTION value="<?= $cat ?>"><?= $cat ?>
<?
}
?>
</SELECT>
<hr>
Item: <SELECT name="item">
<OPTION value="-1">pick category first
</SELECT>
</form>
<script type="text/javascript">
// drop all possible item-values in Object
var category = new Object();
<?
// Create all js-object with their items
foreach($rs as $cat => $items){
// put all $items in JS-readable format.
$JSitems = "";
$itemsWithQuotes = array();
foreach ($items as $oneItem){
$itemsWithQuotes[] = "\"$oneItem\"";
}
?>
category['<?= $cat ?>'] = new Array(<?= implode(",",$itemsWithQuotes) ?>);
<?
}
?>
function populateSecondSelect(){
// get selected category
var selCat = document.forms["testform"].category.selectedIndex;
var catName = document.forms["testform"].category[selCat].value;
// now repopulate the second selectbox
var refSecond = document.forms["testform"].item;
// remove old options
refSecond.length = 0;
// add new options
var theArr = category[catName];
for (var i=0; i< theArr.length ; i++){
refSecond.options[refSecond.options.length] = new
Option(category[catName][i],"hai");
}
}
</script>
</body>
</html>
--------------------------------------
Hope that helps.
Good luck,
Erwin Moller
Krustov wrote: <comp.lang.php , Erwin Moller , si**********************************...y ourself.com> <43***********************@news.xs4all.nl> <Wed, 22 Feb 2006 17:35:57 +0100>
> Do you ever actually help anybody on here who asks a question . > > You only ever seem to comment and give your opinion on 'what' they ask > rather than helping them . Bull. Look around more. I do actually help people, even this OP, as you could see in the part you cutted away. Please go insult somebody else, thanks.
Yes i'd say you do help some people .
But would you say that grants you the right to spout drivel at others .
drivel?
Well thanks.
If you don't care for my postings, I suggest you put me on your blocklist. I
couldn't care less.
Most posters I answer appreciate my effort. If you don't: fine with me.
If, however, you don't like my tone, and want to educate me on that: fine
too, really, point taken.
I am here to help people and get help, not to socialize. No big thing and not the end of the world - but perhaps your forgetting its not just the person you are replying too that sees it .
So what?
Do you think I am not aware of that?
Seriously: If you think that I for some invalid reason was rude: Sorry for
that. But I don't think I was out of line somewhere.
I am trying to help people in here, and when I see bad questions (which I
see a lot lately) I get irritated.
It seems less and less people know how to post in usenet these days.
Regards,
Erwin Moller
Erwin Moller wrote: Alex wrote:
Erwin Moller wrote: Alex wrote:
Hello list
This question has probably already been asked, but let me ask again
I have a mysql database to which I connect with my php scripts. The database contains articles. Name, Unit_Price and Reference
Now my client needs to order 5 items, click a button and a table with 5 lines and 3 columns appears (until now easy)
In the first column is a drop down box with a <select > and <options> in which I store all possible names.
I would like than whenever the client changes one of the boxes (in my case there are 5) the Unite_Price column and Reference column in the line he just choose get automatically updated
Are you talking about Javascript here? Do you want the user to do a select on your page and the page will fill the appropriate fields? Then go Javascript.
Or do you want to go back to the server if somebody touches the selectbox? Then it is PHP.
I think you better do this with Javascript. Try comp.lang.javascript.
If you want to do it in PHP, well... where to start? Do you know how to receive a form in PHP? ($_POST[] and the like) Do you know how to put dynamical data into your html-page with PHP?
If you want to do this in PHP, please be more specific and ask a question that is answerable instead of the complete solution to a problem nobody in here knows except you. :-)
I search all over the web but I could not find it. Really? This is quite basic stuff (both in Javascript and PHP) so I wonder why you didn't find any code that does similar things. (No punch intended)
Good luck.
Regards, Erwin Moller
Thank you for your help
Alex Well you are almost right, this is not only php it is also a bit of Javascript, I need in fact to be able to pass the $fields=mysql_fetch_object($dataresults} to a javascript, but I do not see how I can implement that since I do not know how to pass the result using php, so in that sens it is also php relevant
Ok, clear. So you need data from the database ready-at-hand in a webpage, usable for javascript? Right?
Here follows a simple example, maybe enough to get you going in your own situation.
Suppose you have 1 selectbox, and depending on the value the visitor selects you need to populate a second selectbox. eg: [mainselectbox] category [secondary selectbox] item
You can now simply fill the first selectbox with appropriate options. (You said you already know how, so I skip that part)
Just add an eventhandler to the select, you'll end up with something like this (just the html) <select name="mainselectbox" onChange="populateSecondairy();">
Here follows a comple example. I faked the queryresults to keep things shorter, but if you understand the used Javascript, you are able to modify it for your own uses.
------------------------------ <?
// fakeresult from databasequery that returned category and items $rs = array( "fruit" => array("apple","banana","pineapple"), "books" => array("HitchHikersGuideToTheGalaxy","Programming Perl","Postgresql"), "animals" => array("dog","cat") );
?> <html> <head> <title>test</title> </head> <body>
<form action="bla.php" Method="POST" name="testform"> category: <SELECT name="category" onChange="populateSecondSelect();"> <? foreach($rs as $cat => $items){ ?> <OPTION value="<?= $cat ?>"><?= $cat ?> <? } ?> </SELECT> <hr> Item: <SELECT name="item"> <OPTION value="-1">pick category first </SELECT> </form>
<script type="text/javascript"> // drop all possible item-values in Object var category = new Object();
<? // Create all js-object with their items foreach($rs as $cat => $items){ // put all $items in JS-readable format. $JSitems = ""; $itemsWithQuotes = array(); foreach ($items as $oneItem){ $itemsWithQuotes[] = "\"$oneItem\""; }
?> category['<?= $cat ?>'] = new Array(<?= implode(",",$itemsWithQuotes) ?>); <? } ?>
function populateSecondSelect(){ // get selected category var selCat = document.forms["testform"].category.selectedIndex; var catName = document.forms["testform"].category[selCat].value;
// now repopulate the second selectbox var refSecond = document.forms["testform"].item;
// remove old options refSecond.length = 0;
// add new options var theArr = category[catName]; for (var i=0; i< theArr.length ; i++){ refSecond.options[refSecond.options.length] = new Option(category[catName][i],"hai"); }
}
</script>
</body> </html> --------------------------------------
Hope that helps.
Good luck, Erwin Moller
Thanks Erwin for the code example, I will try it out and figure how to
make it work.
Ohh, and just to add some oil in the fire. Some people do ask questions
not because they want to solve something that there teacher gave them,
but because he knows that other people are specialists in the field and
hence he will find more easily his answer.
You can ask me anything on quantum communications if you like :) That is
one of the reasons why usenet even exists. To be a big community helping
each other.
Any way thank you a lot Erwin
On Wed, 22 Feb 2006 16:10:00 +0100, Alex
<al***************@physics.unige.ch> wrote: I have a mysql database to which I connect with my php scripts. The database contains articles. Name, Unit_Price and Reference
Now my client needs to order 5 items, click a button and a table with 5 lines and 3 columns appears (until now easy)
In the first column is a drop down box with a <select > and <options> in which I store all possible names.
I would like than whenever the client changes one of the boxes (in my case there are 5) the Unite_Price column and Reference column in the line he just choose get automatically updated
I have to agree with Erwin that it's a little hard determining what
exactly the requirement is. You make it sound as if the client first has
to decide how many items to order, then what items to order, and only
then discovers what the price is. That seems very odd.
More usual would be to present a table of items, containing name, price
and reference for each item, and a checkbox against each item to tick,
or an input box to enter how many of each item is needed. That you can
do in HTML with no Javascript at all. But maybe you have something else
in mind?
--
Stephen Poley http://www.xs4all.nl/~sbpoley/webmatters/
Alex wrote: Erwin Moller wrote: Alex wrote:
Erwin Moller wrote: Alex wrote:
> Hello list > > This question has probably already been asked, but let me ask again > > I have a mysql database to which I connect with my php scripts. The > database contains articles. Name, Unit_Price and Reference > > Now my client needs to order 5 items, click a button and a table with > 5 lines and 3 columns appears (until now easy) > > In the first column is a drop down box with a <select > and <options> > in which I store all possible names. > > I would like than whenever the client changes one of the boxes (in my > case there are 5) the Unite_Price column and Reference column in the > line he just choose get automatically updated > Are you talking about Javascript here? Do you want the user to do a select on your page and the page will fill the appropriate fields? Then go Javascript.
Or do you want to go back to the server if somebody touches the selectbox? Then it is PHP.
I think you better do this with Javascript. Try comp.lang.javascript.
If you want to do it in PHP, well... where to start? Do you know how to receive a form in PHP? ($_POST[] and the like) Do you know how to put dynamical data into your html-page with PHP?
If you want to do this in PHP, please be more specific and ask a question that is answerable instead of the complete solution to a problem nobody in here knows except you. :-)
> I search all over the web but I could not find it. Really? This is quite basic stuff (both in Javascript and PHP) so I wonder why you didn't find any code that does similar things. (No punch intended)
Good luck.
Regards, Erwin Moller
> Thank you for your help > > Alex Well you are almost right, this is not only php it is also a bit of Javascript, I need in fact to be able to pass the $fields=mysql_fetch_object($dataresults} to a javascript, but I do not see how I can implement that since I do not know how to pass the result using php, so in that sens it is also php relevant Ok, clear. So you need data from the database ready-at-hand in a webpage, usable for javascript? Right?
Here follows a simple example, maybe enough to get you going in your own situation.
Suppose you have 1 selectbox, and depending on the value the visitor selects you need to populate a second selectbox. eg: [mainselectbox] category [secondary selectbox] item
You can now simply fill the first selectbox with appropriate options. (You said you already know how, so I skip that part)
Just add an eventhandler to the select, you'll end up with something like this (just the html) <select name="mainselectbox" onChange="populateSecondairy();">
Here follows a comple example. I faked the queryresults to keep things shorter, but if you understand the used Javascript, you are able to modify it for your own uses.
------------------------------ <?
// fakeresult from databasequery that returned category and items $rs = array( "fruit" => array("apple","banana","pineapple"), "books" => array("HitchHikersGuideToTheGalaxy","Programming Perl","Postgresql"), "animals" => array("dog","cat") );
?> <html> <head> <title>test</title> </head> <body>
<form action="bla.php" Method="POST" name="testform"> category: <SELECT name="category" onChange="populateSecondSelect();"> <? foreach($rs as $cat => $items){ ?> <OPTION value="<?= $cat ?>"><?= $cat ?> <? } ?> </SELECT> <hr> Item: <SELECT name="item"> <OPTION value="-1">pick category first </SELECT> </form>
<script type="text/javascript"> // drop all possible item-values in Object var category = new Object();
<? // Create all js-object with their items foreach($rs as $cat => $items){ // put all $items in JS-readable format. $JSitems = ""; $itemsWithQuotes = array(); foreach ($items as $oneItem){ $itemsWithQuotes[] = "\"$oneItem\""; }
?> category['<?= $cat ?>'] = new Array(<?= implode(",",$itemsWithQuotes) ?>); <? } ?>
function populateSecondSelect(){ // get selected category var selCat = document.forms["testform"].category.selectedIndex; var catName = document.forms["testform"].category[selCat].value;
// now repopulate the second selectbox var refSecond = document.forms["testform"].item;
// remove old options refSecond.length = 0;
// add new options var theArr = category[catName]; for (var i=0; i< theArr.length ; i++){ refSecond.options[refSecond.options.length] = new Option(category[catName][i],"hai"); }
}
</script>
</body> </html> --------------------------------------
Hope that helps.
Good luck, Erwin Moller
Thanks Erwin for the code example, I will try it out and figure how to make it work.
You are welcome.
I hope you can figure it out.
Just copy it to a file, name it test.php, and run.
Then you can judge if that is what you wanted in the first place. :P
The trick is the Javascript, not the PHP.
If you need help or something, just come back here or mail me at er*************@xs4all.nl (remove all 4 z) Ohh, and just to add some oil in the fire. Some people do ask questions not because they want to solve something that there teacher gave them, but because he knows that other people are specialists in the field and hence he will find more easily his answer.
Yeah, I know.
It wasn't me who claimed you were asking your teacher's questions by the
way.
I developed an extra sense for that: People who are asking others to do
their homework.
I was in a terrible mood earlier today and easily irritated.
Sorry if I snarled at you. You can ask me anything on quantum communications if you like :) That is one of the reasons why usenet even exists. To be a big community helping each other.
Really!??
WOW: You will be sorry for that. :P
I think that rules. :-) Quantum communications. I didn't even know one could
study that.
I like to study a little cosmology as a hobby and that means nowadays you
have to study quantumphysics too as you undoubtely know. But my primary
source of knowlegde comes from Special issues of Scientific American, so
you can imagine I still have a few questions. ;-)
Well, I always wondered: If some particle (A) falls appart in two other
particles (A->B+C), and we have a detector a few million miles away from
the place where that happened, and that detector measures some property,
like spin, of the particle (B): I understood the accompannying particle (C)
will instantly get the appropriate property too. (I hope you know what I am
referring to: I think it is called entanglement or something like that.)
Question: Isn't that faster-than-light communication?
And if you study quantum communications, can't you use that principle
somehow for very fast (instantanious) communication?
Ok, good luck trying to explain that to an idiot like me. :-) Any way thank you a lot Erwin
You are welcome.
Regards,
Erwin Moller
Krustov wrote: <comp.lang.php , Erwin Moller , si**********************************...y ourself.com> <43***********************@news.xs4all.nl> <Wed, 22 Feb 2006 18:37:13 +0100>
I am trying to help people in here, and when I see bad questions (which I see a lot lately) I get irritated. It seems less and less people know how to post in usenet these days.
Newbies dont always know the best way to word a help question - or what info they should supply that would be useful to the advice giver .
Its part of usenet on any technical newsgroup you care to mention and always will be .
If your willing to accept its a futile battle and nothing you ever say will make any difference as new subscribers almost never read the back posts and will just ask their question straight away - then isnt it yourself who is making yourself get irritated .
Like old leather some things become quite comfortable .
Well, all true. But if you never tell a kid it is considered rude to take a
leak against somebody else...
Anyway, let's drop this and have a beer instead.
*offers a virtual but otherwise great tasting beer*
Regards,
Erwin Moller
Krustov wrote: <comp.lang.php , Erwin Moller , si**********************************...y ourself.com> <43***********************@news.xs4all.nl> <Wed, 22 Feb 2006 16:46:51 +0100>
I search all over the web but I could not find it.
Really? This is quite basic stuff (both in Javascript and PHP) so I wonder why you didn't find any code that does similar things. (No punch intended)
Do you ever actually help anybody on here who asks a question .
You only ever seem to comment and give your opinion on 'what' they ask rather than helping them .
Actually, I agree with Erwin. My comment would have been exactly the same.
This is a PHP newsgroup. If he wants a javascript solution, he needs to
visit a javascript newsgroup.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
Hello,
on 02/22/2006 12:10 PM Alex said the following: Hello list
This question has probably already been asked, but let me ask again
Yes, it was asked just a couple of days before. Here is the archived
response that I sent presenting a solution based on a plug-in for a
forms generation class that automatically links select inputs to switch
groups of options depending on the previous select and retrieves options
dynamically from a database: http://groups.google.com/group/comp....630eb27d9e9cf1
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/
Erwin Moller wrote: Yeah, I know. It wasn't me who claimed you were asking your teacher's questions by the way. I developed an extra sense for that: People who are asking others to do their homework.
Just for the record, neither did I - I just said that it has been seen
far too many times in these forums. You are welcome.
Regards, Erwin Moller
Erwin Moller wrote: Alex wrote:
Erwin Moller wrote: Alex wrote:
Erwin Moller wrote: > Alex wrote: > >> Hello list >> >> This question has probably already been asked, but let me ask again >> >> I have a mysql database to which I connect with my php scripts. The >> database contains articles. Name, Unit_Price and Reference >> >> Now my client needs to order 5 items, click a button and a table with >> 5 lines and 3 columns appears (until now easy) >> >> In the first column is a drop down box with a <select > and <options> >> in which I store all possible names. >> >> I would like than whenever the client changes one of the boxes (in my >> case there are 5) the Unite_Price column and Reference column in the >> line he just choose get automatically updated >> > Are you talking about Javascript here? > Do you want the user to do a select on your page and the page will fill > the appropriate fields? Then go Javascript. > > Or do you want to go back to the server if somebody touches the > selectbox? Then it is PHP. > > > I think you better do this with Javascript. > Try comp.lang.javascript. > > If you want to do it in PHP, well... where to start? > Do you know how to receive a form in PHP? ($_POST[] and the like) > Do you know how to put dynamical data into your html-page with PHP? > > If you want to do this in PHP, please be more specific and ask a > question that is answerable instead of the complete solution to a > problem nobody in here knows except you. :-) > > >> I search all over the web but I could not find it. > Really? > This is quite basic stuff (both in Javascript and PHP) so I wonder why > you didn't find any code that does similar things. > (No punch intended) > > Good luck. > > Regards, > Erwin Moller > >> Thank you for your help >> >> Alex Well you are almost right, this is not only php it is also a bit of Javascript, I need in fact to be able to pass the $fields=mysql_fetch_object($dataresults} to a javascript, but I do not see how I can implement that since I do not know how to pass the result using php, so in that sens it is also php relevant Ok, clear. So you need data from the database ready-at-hand in a webpage, usable for javascript? Right?
Here follows a simple example, maybe enough to get you going in your own situation.
Suppose you have 1 selectbox, and depending on the value the visitor selects you need to populate a second selectbox. eg: [mainselectbox] category [secondary selectbox] item
You can now simply fill the first selectbox with appropriate options. (You said you already know how, so I skip that part)
Just add an eventhandler to the select, you'll end up with something like this (just the html) <select name="mainselectbox" onChange="populateSecondairy();">
Here follows a comple example. I faked the queryresults to keep things shorter, but if you understand the used Javascript, you are able to modify it for your own uses.
------------------------------ <?
// fakeresult from databasequery that returned category and items $rs = array( "fruit" => array("apple","banana","pineapple"), "books" => array("HitchHikersGuideToTheGalaxy","Programming Perl","Postgresql"), "animals" => array("dog","cat") );
?> <html> <head> <title>test</title> </head> <body>
<form action="bla.php" Method="POST" name="testform"> category: <SELECT name="category" onChange="populateSecondSelect();"> <? foreach($rs as $cat => $items){ ?> <OPTION value="<?= $cat ?>"><?= $cat ?> <? } ?> </SELECT> <hr> Item: <SELECT name="item"> <OPTION value="-1">pick category first </SELECT> </form>
<script type="text/javascript"> // drop all possible item-values in Object var category = new Object();
<? // Create all js-object with their items foreach($rs as $cat => $items){ // put all $items in JS-readable format. $JSitems = ""; $itemsWithQuotes = array(); foreach ($items as $oneItem){ $itemsWithQuotes[] = "\"$oneItem\""; }
?> category['<?= $cat ?>'] = new Array(<?= implode(",",$itemsWithQuotes) ?>); <? } ?>
function populateSecondSelect(){ // get selected category var selCat = document.forms["testform"].category.selectedIndex; var catName = document.forms["testform"].category[selCat].value;
// now repopulate the second selectbox var refSecond = document.forms["testform"].item;
// remove old options refSecond.length = 0;
// add new options var theArr = category[catName]; for (var i=0; i< theArr.length ; i++){ refSecond.options[refSecond.options.length] = new Option(category[catName][i],"hai"); }
}
</script>
</body> </html> --------------------------------------
Hope that helps.
Good luck, Erwin Moller Thanks Erwin for the code example, I will try it out and figure how to make it work.
You are welcome. I hope you can figure it out.
Just copy it to a file, name it test.php, and run. Then you can judge if that is what you wanted in the first place. :P The trick is the Javascript, not the PHP.
If you need help or something, just come back here or mail me at er*************@xs4all.nl (remove all 4 z)
Ohh, and just to add some oil in the fire. Some people do ask questions not because they want to solve something that there teacher gave them, but because he knows that other people are specialists in the field and hence he will find more easily his answer.
Yeah, I know. It wasn't me who claimed you were asking your teacher's questions by the way. I developed an extra sense for that: People who are asking others to do their homework.
I was in a terrible mood earlier today and easily irritated. Sorry if I snarled at you.
You can ask me anything on quantum communications if you like :) That is one of the reasons why usenet even exists. To be a big community helping each other.
Really!?? WOW: You will be sorry for that. :P I think that rules. :-) Quantum communications. I didn't even know one could study that.
I like to study a little cosmology as a hobby and that means nowadays you have to study quantumphysics too as you undoubtely know. But my primary source of knowlegde comes from Special issues of Scientific American, so you can imagine I still have a few questions. ;-)
Well, I always wondered: If some particle (A) falls appart in two other particles (A->B+C), and we have a detector a few million miles away from the place where that happened, and that detector measures some property, like spin, of the particle (B): I understood the accompannying particle (C) will instantly get the appropriate property too. (I hope you know what I am referring to: I think it is called entanglement or something like that.) Question: Isn't that faster-than-light communication? And if you study quantum communications, can't you use that principle somehow for very fast (instantanious) communication?
Ok, good luck trying to explain that to an idiot like me. :-)
Any way thank you a lot Erwin
You are welcome.
Regards, Erwin Moller
Dear Erwin,
I was not aiming anyone special by saying that I am not part of these
students doing there homework. It was posted as an answer together with
all the other text.
As for your question :
Indeed when a particles B and C are entangled (going from A to B+C is
just a way of producing it, but this does not mean that they are
automatically entangled) you can have funny effects but not faster than
light communication. Follow the rest :
Suppose Alice and Bob who each receive one of these particles. Alice
gets B and Bob gets C.
Now Alice measures property of B. She gets randomly B+ or B- (because B
can have 2 values either + or-).
Bob also measures his photon and gets randomly C+ or C-
Now, if Bob calls Alice and tells her : Hey Alice, for photon number 483
i measured a +, she will answer : Yeah me too, same goes for -
So you see that indeed Alice and Bob measure the same thing, BUT, and
this is the important point, Alice 8neither bob) can choose if the
output will be + or -, so they can not send bits to each other. It is
completely random but the correlations are not
So no superluminal communication, sorry, you are not going to get rich.
(You can still do quantum teleportation with it :) )
Alex
Krustov wrote: <comp.lang.php , Erwin Moller , si**********************************...y ourself.com> <43***********************@news.xs4all.nl> <Wed, 22 Feb 2006 21:22:53 +0100>
Anyway, let's drop this and have a beer instead. *offers a virtual but otherwise great tasting beer*
I'd much prefer a large joint old chap .
Unlike bill the ex president - I inhale :-)
I am from Holland mate.
So that is no problem.
Let me know when you visit my nice little country. :P
Erwin Moller This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: 35th Ave Media |
last post by:
Hello,
I have about 60+ pages that I need to insert a MAILTO: tag so people can
email the page using their email client. The body of the message is
going to be the URL of that page. Using ASP,...
|
by: Anthony |
last post by:
So I've got three dropdowns in a datagrid footer (to add records). I need
them to cascade, in the first one I have three choices, in the second one I
have anywhere from 3 to 10 choices, depending...
|
by: Woody Splawn |
last post by:
I have a question about technique with regard to filling drop downs.
I have a Winform that has several different tabs and tables associated with
it. In an effort to keep the load time small I...
|
by: firstcustomer |
last post by:
Further to my earlier post, I've found something that does partly what
I'm doing, but there are two issues:
1) There is an error in the script. Being a Javascript newbie, I've no
idea what the...
|
by: phpnewbie2007 |
last post by:
I have 2 dynamic PHP dropdowns:
The second dropdown populates from the first, depending on what is selected in the first.
The page is showing issues in a department:
The first dropdown...
|
by: MaryamSh |
last post by:
Hi,
I am creating a Dynamic Search in my application.
I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove)
By pressing Add button...
|
by: MaryamSh |
last post by:
Create Dynamic Dropdownlist Controls and related event
--------------------------------------------------------------------------------
Hi,
I am creating a Dynamic Search in my application.
I...
|
by: =?Utf-8?B?c3RldmVuIHNjYWlmZQ==?= |
last post by:
Hi
I have been banging my head for a few days now with this issue.
I have a page that has several update panels everything is working fine
except for 1 thing.
I am creating a sort of wizard...
|
by: bytesFTW99 |
last post by:
I have been struggling with this for some time can anyone help out? just trying to have 3 dropdown boxes that fill depending on what is selected, then in some cases click a button and have the second...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
header("Location:".$urlback);
Is this the right layout the...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
| |