& terminates string?
| From: | Fire Marshal's Office) | Date: | Thu, 06 Jan 2005 17:33:33 +0000 |
| Subject: | & terminates string? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-38018@lists.php.net to get a copy of this message | ||
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