Hi, I have created a page which includes an HTML form, but I need to make the ACTION attribute a PHP variable so that it can differ depending on something that is set earlier in the page. The syntax I am trying is as follows: echo( "<form method=\"post\" action=\"$photofile\">" ); I have tried all sorts of combinations of single and double quotes but can't get anything to work. Can anyone help me please?! Many thanks in advance for your help. Mike
Your code above should be working. Where does $photofile come from? Is it set? Maybe if you post the rest of your code we can help. In the meanwhile you can have a look at this page, where all possibilities on putting variables in strings are listed and explained. http://www.php.net/manual/en/language.types.string.php
The line you pasted is correct and it shud work, The problem is with the $photofile variable, its either, 1. it have no value 2. it carries the wrong value try checking the spelling or paste more of the codes that shows the variable journeying down
Disregard this issue. I was being an idiot. The form was created inside a function but the variable was declared outside and not passed in! Doh!