473,788 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP Javascript forms

Hey,

My old boss wrote an extensive work tracking system in php for
internal use. He left and the server he is running it on is very
outdated so I have been given the task of transfering it over to a new
server and the latest versions of php, mysql, and apache. That
information is probably not relevant to the question.

His system has some javascript forms. One of which is a drop down
menu that uses the onchange functionality. Here is the code:

echo "<FORM NAME=\"changeda y\" METHOD=\"post\"
ACTION=\"worken tries.php\">\n" ;
echo "<SELECT NAME=\"xselecte d_date\"
onchange=\"mySu bmit('changeday ')\";>\n";
for($i=0;$i<$pa st_days;$i++){ // loop through past X days
echo "<OPTION VALUE='".$dates[$i]."' "; // output option
if ($dates[$i] == $selected_date) {echo "selected"; } // hilight
currently selected
echo ">".$months[$i]."/".$days[$i]; // finish option
} // end of past months loop
echo "</SELECT>\n"; // end of pull down menu
echo "<input type=hidden name=xtech value='".$tech. "'>"; // keep
currently selected tech
echo "</form>\n"; // end of change month form
I realize this is messy code, that is why this has been so hard for me.

My problem is the following:

The selected value in the menu is set to $xselected_date . Then upon a
change the form is submited back to this same php file. At the
begginning of this php script the code then does:

if (isset($xselect ed_date)) {blah blah blah}

But this conditional is never evaluating true. Does the select name
variable not remain declared across the form submit? If not, is there
a way around this.

Thank you in advance for the help, if i need to provide any more
information please let me know.

-Eric

Oct 2 '06 #1
4 1274

Er************* **@gmail.com wrote:
Hey,

My old boss wrote an extensive work tracking system in php for
internal use. He left and the server he is running it on is very
outdated so I have been given the task of transfering it over to a new
server and the latest versions of php, mysql, and apache. That
information is probably not relevant to the question.

His system has some javascript forms. One of which is a drop down
menu that uses the onchange functionality. Here is the code:

echo "<FORM NAME=\"changeda y\" METHOD=\"post\"
ACTION=\"worken tries.php\">\n" ;
echo "<SELECT NAME=\"xselecte d_date\"
onchange=\"mySu bmit('changeday ')\";>\n";
for($i=0;$i<$pa st_days;$i++){ // loop through past X days
echo "<OPTION VALUE='".$dates[$i]."' "; // output option
if ($dates[$i] == $selected_date) {echo "selected"; } // hilight
currently selected
echo ">".$months[$i]."/".$days[$i]; // finish option
} // end of past months loop
echo "</SELECT>\n"; // end of pull down menu
echo "<input type=hidden name=xtech value='".$tech. "'>"; // keep
currently selected tech
echo "</form>\n"; // end of change month form
I realize this is messy code, that is why this has been so hard for me.

My problem is the following:

The selected value in the menu is set to $xselected_date . Then upon a
change the form is submited back to this same php file. At the
begginning of this php script the code then does:

if (isset($xselect ed_date)) {blah blah blah}

But this conditional is never evaluating true. Does the select name
variable not remain declared across the form submit? If not, is there
a way around this.

Thank you in advance for the help, if i need to provide any more
information please let me know.

-Eric
Oct 2 '06 #2
Some more information:

This script worked on the old server but does not work on the new
server. The new server is running php 5.2 I am not sure what version
of php the old server was running but it was at least a year or 2 old.

Er************* **@gmail.com wrote:
Hey,

My old boss wrote an extensive work tracking system in php for
internal use. He left and the server he is running it on is very
outdated so I have been given the task of transfering it over to a new
server and the latest versions of php, mysql, and apache. That
information is probably not relevant to the question.

His system has some javascript forms. One of which is a drop down
menu that uses the onchange functionality. Here is the code:

echo "<FORM NAME=\"changeda y\" METHOD=\"post\"
ACTION=\"worken tries.php\">\n" ;
echo "<SELECT NAME=\"xselecte d_date\"
onchange=\"mySu bmit('changeday ')\";>\n";
for($i=0;$i<$pa st_days;$i++){ // loop through past X days
echo "<OPTION VALUE='".$dates[$i]."' "; // output option
if ($dates[$i] == $selected_date) {echo "selected"; } // hilight
currently selected
echo ">".$months[$i]."/".$days[$i]; // finish option
} // end of past months loop
echo "</SELECT>\n"; // end of pull down menu
echo "<input type=hidden name=xtech value='".$tech. "'>"; // keep
currently selected tech
echo "</form>\n"; // end of change month form
I realize this is messy code, that is why this has been so hard for me.

My problem is the following:

The selected value in the menu is set to $xselected_date . Then upon a
change the form is submited back to this same php file. At the
begginning of this php script the code then does:

if (isset($xselect ed_date)) {blah blah blah}

But this conditional is never evaluating true. Does the select name
variable not remain declared across the form submit? If not, is there
a way around this.

Thank you in advance for the help, if i need to provide any more
information please let me know.

-Eric
Oct 2 '06 #3
<Er************ ***@gmail.comwr ote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
Hey,

My old boss wrote an extensive work tracking system in php for
internal use. He left and the server he is running it on is very
outdated so I have been given the task of transfering it over to a new
server and the latest versions of php, mysql, and apache. That
information is probably not relevant to the question.

His system has some javascript forms. One of which is a drop down
menu that uses the onchange functionality. Here is the code:

echo "<FORM NAME=\"changeda y\" METHOD=\"post\"
ACTION=\"worken tries.php\">\n" ;
echo "<SELECT NAME=\"xselecte d_date\"
onchange=\"mySu bmit('changeday ')\";>\n";
for($i=0;$i<$pa st_days;$i++){ // loop through past X days
echo "<OPTION VALUE='".$dates[$i]."' "; // output option
if ($dates[$i] == $selected_date) {echo "selected"; } // hilight
currently selected
echo ">".$months[$i]."/".$days[$i]; // finish option
} // end of past months loop
echo "</SELECT>\n"; // end of pull down menu
echo "<input type=hidden name=xtech value='".$tech. "'>"; // keep
currently selected tech
echo "</form>\n"; // end of change month form
I realize this is messy code, that is why this has been so hard for me.

My problem is the following:

The selected value in the menu is set to $xselected_date . Then upon a
change the form is submited back to this same php file. At the
begginning of this php script the code then does:

if (isset($xselect ed_date)) {blah blah blah}

But this conditional is never evaluating true. Does the select name
variable not remain declared across the form submit? If not, is there
a way around this.

Thank you in advance for the help, if i need to provide any more
information please let me know.

-Eric
Hi Eric,
are you getting ANY of the variables passed into workentries.php ?

If not, you probably had Register Globals ON, on the old system, and they
would be set to off on the new one

at a 'cleaner' alternative, you could revise each variable reference to:

$_REQUEST['variablename'] where variable name is the HTML field name
Not this MUST be case perfect.

HTH
Cheers,

Ron Barnett
IT Support for Business
www.rjbarnett.co.uk

-----------------------------------------------------------------------------------------
For labellers and labelling supplies visit www.labelzrus.co.uk
Oct 2 '06 #4
Er************* **@gmail.com wrote:
Hey,

My old boss wrote an extensive work tracking system in php for
internal use. He left and the server he is running it on is very
outdated so I have been given the task of transfering it over to a new
server and the latest versions of php, mysql, and apache. That
information is probably not relevant to the question.

His system has some javascript forms. One of which is a drop down
menu that uses the onchange functionality. Here is the code:

echo "<FORM NAME=\"changeda y\" METHOD=\"post\"
ACTION=\"worken tries.php\">\n" ;
echo "<SELECT NAME=\"xselecte d_date\"
onchange=\"mySu bmit('changeday ')\";>\n";
for($i=0;$i<$pa st_days;$i++){ // loop through past X days
echo "<OPTION VALUE='".$dates[$i]."' "; // output option
if ($dates[$i] == $selected_date) {echo "selected"; } // hilight
currently selected
echo ">".$months[$i]."/".$days[$i]; // finish option
} // end of past months loop
echo "</SELECT>\n"; // end of pull down menu
echo "<input type=hidden name=xtech value='".$tech. "'>"; // keep
currently selected tech
echo "</form>\n"; // end of change month form
I realize this is messy code, that is why this has been so hard for me.

My problem is the following:

The selected value in the menu is set to $xselected_date . Then upon a
change the form is submited back to this same php file. At the
begginning of this php script the code then does:

if (isset($xselect ed_date)) {blah blah blah}

But this conditional is never evaluating true. Does the select name
variable not remain declared across the form submit? If not, is there
a way around this.

Thank you in advance for the help, if i need to provide any more
information please let me know.

-Eric

Register_global s is off, by default in Php5 and that appears to be your
problem.

Your conditional would need to be:
if (isset($_POST['xselected_date '])) {blah blah blah}

You will need to make similar changes *all over the place* (for all GET,
POST, and COOKIE variables).

I'll probably get thrashed for saying this, but if you want to see your
scripts work, ... right now ... change register_global s to on in php.ini.

This creates a potential security hole and it is not advised (hence the
default setting in Php5), so you may want to work on the more long term
solution. Most all hosts refuse to run with register_global s on because
of the security issues.

On your own server, it's your own call. Having register_global s on means
you need to be very careful how you treat POST and GET variables.

--
*************** **************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
*************** **************
Oct 2 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
7073
by: Gowhera Hussain | last post by:
Use This for Learning Only .... Do Not Try To Act Smart HACKING WITH JAVASCRIPT Dr_aMado Sun, 11 Apr 2004 16:40:13 UTC This tutorial is an overview of how javascript can be used to bypass simple/advanced html forms and how it can be used to override cookie/session
3
6306
by: bhanubalaji | last post by:
hi, I am unable to disable the text(label) in javascript..it's working fine with IE,but i am using MOZILLA.. can any one help regarding this.. What's the wrong with my code? I am sending my code here.. Thanks in Advance... Regards
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.