Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2005011

[PHP-DB] & terminates string? From: Perry, Matthew (Fire Marshal's Office) (Matthew.Perry <email protected>)
Date: 01/06/05

I am using PHP 4.3.1 and running Apache Server and MySQL.

The following question is probably only related to PHP.

 

Here is the problem:

 

I am passing the following string from one form to another:

"../create.php?dest=Employee/menu_handleemployee.php?action=update&ID=$ID"

 

Here is the actual code:

<form
action="../create.php?dest=Employee/menu_handleemployee.php?action=update&ID
=<?echo $ID;?>" method="post" enctype="multipart/form-data"
name="form1EMPLOYEE">

 

When I view the source it comes out as expected:

<form
action="../create.php?dest=Employee/menu_handleemployee.php?action=update&ID
=82"

method="post" enctype="multipart/form-data" name="formEMPLOYEE">

 

But after it goes to the next page it turns into this:

"../create.php?dest=Employee/menu_handleemployee.php?action=update"

Everything up to and after the '&' disappears!!

 

The goal of this code is to send the redirect address to the form that
modifies my data.

I want variable "dest" to be used to dynamically redirect the page.

 

I have tried the following to fix the problem without avail:

1) I tried saving the variable in other ways such as text fields in the form
itself.

2) I tried addslashes() (which works well with similar problems related to
', " etc.).

3) I tried adding \ before &

4) I danced around my computer and threatened to pull the plug.

None of these worked!

 

 

What is it about '&' that throws everything off with PHP variables? It
doesn't seem to be a problem with HTML.

This is exceedingly difficult to research online because '&' is excluded
from most search engines automatically.

 

-Matthew