TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-22-2009, 08:09 PM   #1 (permalink)
The Visitor
 
Join Date: Jul 2009
Posts: 2
Thanks: 0
Shiag is on a distinguished road
Default 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>");
}
Shiag is offline  
Reply With Quote
Old 07-23-2009, 08:56 AM   #2 (permalink)
The Contributor
 
Normo's Avatar
 
Join Date: Oct 2008
Location: UK
Posts: 30
Thanks: 0
Normo is on a distinguished road
Default

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>
Normo is offline  
Reply With Quote
Old 07-23-2009, 10:08 AM   #3 (permalink)
The Visitor
 
Join Date: Jul 2009
Posts: 2
Thanks: 0
Shiag is on a distinguished road
Default

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.
Shiag is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
10 PHP Myths Dispelled Wildhoney General 9 06-15-2009 06:55 AM
Should I drop PHP for Java? webosb General 11 04-05-2009 06:58 AM
Load url on select, via drop down menu h0ly lag XHTML, HTML, CSS 2 10-03-2008 05:39 AM
PHP Compressor Kalle Script Giveaway 8 05-28-2008 12:14 AM
Drop down menu in javascript imilkcheese Javascript, AJAX, E4X 2 05-08-2008 04:31 PM


All times are GMT. The time now is 06:42 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design