View Full Version : js reference to a PHP variable

07-25-2009, 07:38 AM

i have this code:
if (! $_POST["Name"] || ! $_POST["LName"] || ! $_POST["email"] || ! $_POST["phone"])
$Alert_Message = "Invalid Form";
}i got a js script from another forum here on this site that looks like this, and does work well:
print <<<JSOUT
<script type="text/javascript">
confirm("Form is INVALID");
exit;i have 4 different messages that i want to choose from to be displayed in the js script, and I want to store the message that i want to use in a PHP variable along the way. the variable is: $Alert_Message . i am trying to do this with my confirm() function in js:
confirm($Alert_Message);the code is not registering, so something is obviously wrong. can i reference PHP this way in a js script? if not, how would i go about doing this another way? can i change a js variable along the way in my PHP code instead, and then reference THAT variable when i get to my js script? i appreciate any help on this...

07-25-2009, 11:39 AM
i have solved this issue...thank you to anyone who took the time to read...