TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   php drop down menu (http://www.talkphp.com/absolute-beginners/4771-php-drop-down-menu.html)

Shiag 07-22-2009 08:09 PM

php drop down menu
 
ok so I am new to php, and I am trying to make a drop down menu that has different actions. when you make your selection I want you to be sent to a php function that clears the table, enables the checkboxes, and brings up an alert inside of a class that makes a table of information, right now I am stuck on the checkbox enabling here is my code:

class table
{
function display()
//Begin display() function.
{
/**
* Creation of the table to be used by the website.
* <li>Global variable <code>$custNum</code> is put in the title of the table</li>
* <li>The column titles are given.</li>
* <li>The drop down box is created.</li>
*/
print("
<html>
<head>
<SCRIPT LANGUAGE='JavaScript'>
<!--
function enable()
{
if(document.getElementById('which') = 3)
{
document.form.checkbox.disabled = false;
}
else
{
document.form.checkbox.disabled = true;
}
}
</script>
<table width='100%'>");
print("<tr>
<td><input type='checkbox' disabled size='10' name='checkbox' value = 'ON'></td>
<td><select name = "status" onchange=enable(document.form.status.selectedIndex )>
<option name = "process" value = "process">Process</option>
<option name = "cancel" value="cancel">Cancel</option>
<option name = "partial" value="partial">Partial</option>
</select></td>
</tr>");
}

Normo 07-23-2009 08:56 AM

You've missed out the <form> tag, the </head> tag, the <body> tag, the </body> tag, the end comment tag in the JavaScript, the </html> tag and the </table> tag.

For most of what you described you can achieve with JavaScript. As for inserting information into the table, I would suggest using sessions as it seems you are using a user system, right?

PHP Code:

<?php
session_start
();
if(
$_SESSION['id'] != $userId || $_SESSION['user'] != $user){
session_destroy();
session_unset();
header('Location: login.php');
}
?>
<html>
<head>
...
</head>
<body>
<h1><?php echo $_SESSION['user'?></h1> //returns current username
</body>
</html>


Shiag 07-23-2009 10:08 AM

yeah, right now I have the javascript inbedded in the php class, and my program talks to a webservice to get that gets order information and displays it to the vendor so they can prepare the order mark it as processed, canceled or partially processed which will send the status back to the web service and repopulate the tables.


All times are GMT. The time now is 08:51 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0