NYCPHP Meetup

NYPHP.org

[nycphp-talk] How do I evaluate variables in a heredoc?

Webapprentice . webapprentice at mail.com
Mon Jan 5 23:15:35 EST 2004


Hi,
I'm trying to print out the contents of the $errorMessage array in this heredoc, but if I don't put the double quotes around the variable, PHP gives me an error.  If I use the double quotes and the variable happens to be empty, I get "" in the page, which is not what I want.

How do I fix this?

Thanks,
Stephen

		echo <<< UPLOADFORM
		<form action="$_SERVER[PHP_SELF]" method="post" enctype="multipart/form-data">
		
		<table cellpadding="5" cellspacing="5" class="submissionstable">
		<tr>
		<td class="submissionfield">Name:</td>
		<td><input type="text" name="username" size="30" /> "$errorMessage[username]"</td>
		</tr>
		<tr>
    	<td class="submissionfield">Email Address:</td>
 		<td><input type="text" name="email" size="30" /> "$errorMessage[email]"</td>
		</tr>
		<tr>
		<td class="submissionfield">Soundtrack Title:</td>
		<td><input type="text" name="title" size="30" /> "$errorMessage[title]"</td>
		</tr>
		<tr>
		<td class="submissionfield">Composed by:</td>
		<td><input type="text" name="composer" size="30" /> "$errorMessage[composer]"</td>
		</tr>
		<tr>
		<td class="submissionfield">Arranged by:</td>
		<td><input type="text" name="arranger" size="30" /> "$errorMessage[arranger]"</td>
		</tr>
		<tr>
		<td class="submissionfield">Publisher:</td>
		<td><input type="text" name="publisher" size="30" /> "$errorMessage[publisher]"</td>
		</tr>
		<tr>
		<td class="submissionfield">Catalog Number:</td>
		<td><input type="text" name="catalognumber" size="30" /> "$errorMessage[catalognumber]"</td>
		</tr>
		<tr>
		<td class="submissionfield">CD Info:</td>
		<td><input type="text" name="cdinfo" size="30" /> "$errorMessage[cdinfo]"</td>
		</tr>
		<tr>
		<td class="submissionfield">Release Date:</td>
		<td><input type="text" name="releasedate" size="30" /> "$errorMessage[releasedate]"</td>
		</tr>
		<tr>
		<td class="submissionfield">Disc Time:</td>
		<td><input type="text" name="disctime" size="30" /> "$errorMessage[disctime]"</td>
		</tr>
		<tr>
		<td class="submissionfield">Tracklist:</td>
		<td><textarea name="tracklist" rows="10" cols="50"></textarea> "$errorMessage[tracklist]"</td>
		</tr>
		<tr>
		<td class="submissionfield">Translation by:</td>
		<td><input type="text" name="translator" size="30" /> "$errorMessage[translator]"</td>
		</tr>		
		<tr>
    	<td class="newsitem">Front CD Cover Image (BMP, JPG, or GIF):</td>
		<td><input name="frontimage" type="file" size="60" /> "$errorMessage[frontimage]"</td>
		</tr>
		<tr>
    	<td class="newsitem">Rear CD Cover Image (BMP, JPG, or GIF):</td>
		<td><input name="rearimage" type="file" size="60" /> "$errorMessage[rearimage]"</td>
		</tr>
		<tr>
		<td class="newsitem"><input type="submit" value="Submit" /></td>
		<td><input type="hidden" name="stage" value="process" /></td>
		</tr>
		</table>
		</form>		
UPLOADFORM;
-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm




More information about the talk mailing list