Jump to content

Select and POST


SieRobin

Recommended Posts

You need to look into AJAX. I dont know much about it, but it basicly triggers something to run using javascript's onChange/OnClick etc, then it can preform stuff in the background (using PHP for an example) and send the information back to the page and finally change the page dynamiclly using JavaScript.

But you can make everything more simple by getting all the information to the page, and then make javascript display the required information when onChange is triggered.

Orio
Link to comment
https://forums.phpfreaks.com/topic/26603-select-and-post/#findComment-121686
Share on other sites

I use Ajax for my chatroom, which just keeps sending calls to the database, so it's a Live chatroom instead of refreshing the page everytime you want to see what was posted.

What you're saying is that I can use the onChange feature to actually trigger what will be inserted into the table when they Choose something from the select menu?
Link to comment
https://forums.phpfreaks.com/topic/26603-select-and-post/#findComment-121691
Share on other sites

I say load all the data you that you might want to output into the javascript part and HTML part, and everytime something is selected, dynamicly display it using javascript.

[code]<html><head>
<scrip>
function description() {
msg = new Array();
msg['1'] = "Description 1"; //populate these using php
msg['2'] = "Description of something";
var updiv = document.getElementById("description");
updiv.innerHTML = "Description- "+msg[document.dropdown.drop.selectedIndex];
}
</scrip>
</head>
<body>
<FORM name="dropdown">
<SELECT name="drop" onChange="javascript:description();">
<OPTION SELECTED>-------
<OPTION value="1">Prod 1  <!-- populate these using php -->
<OPTION value="2">Prod 2
</SELECT>
</FORM>
<div id="description"></div>
</form>
</body>
</html>[/code]

** Note- I changed the script tag to <scrip> because SMF doesnt like it.

Orio.
Link to comment
https://forums.phpfreaks.com/topic/26603-select-and-post/#findComment-121709
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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