PDA

View Full Version : I'm trying to create a form...


King Kovifor
03-18-2006, 07:29 PM
OK I'm trying to create a form that'll create a php code section in a specified php file... but I get
Parse error: syntax error, unexpected T_CHARACTER, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/jeremy/public_html/kkgraphics/write_img_info.php on line 3
when I click submit... can someone please look at my code and see if I've got any mistakes:

FORM (new_image_form.html):

<form name="add_img_info" method="post" action="write_img_info.php">
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td align="left" valing="top">
<strong>Image ID (please add one to the last image id):</strong>
</td>
<td align="left">
<input name="img_id" type="text" value="Image ID" />
<tr>
<td align="left" valign="top">
<strong>Image Url:</strong>
</td>
<td align="left">
<input name="img_url" type="text" value="Image URL" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong>Image Alt:</strong>
</td>
<td align="left">
<input name="img_alt" type="text" value="Image Alt" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong>Image Name:</strong>
</td>
<td align="left">
<input name="img_name" type="text" value="Image Name" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong>Image Height:</strong>
</td>
<td align="left">
<input name="img_height" type="text" value="Image Height" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong>Image Width:</strong>
</td>
<td align="left">
<input name="img_width" type="text" value="Image Width" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong>Image Category:</strong>
</td>
<td align="left">
<input name="img_category" type="text" value="Image Category" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong>Image Release Date:</strong>
</td>
<td align="left">
<input name="img_release" type="text" value="Image Release Date" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong>Downloadable For Personal Use?</strong>
</td>
<td align="left">
<input name="img_download" type="text" value="Yes or No?" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong>Image Version:</strong>
</td>
<td align="left">
<input name="img_version" type="text" value="Image Version" />
</td>
</tr>
<tr>
<td align="center" valign="middle" colspan="2">
<br /><input type="submit" name="add_img_info" value="Submit!" />
</td>
</tr>
</table>
</form>

write_img_info.php (PHP Script to write php code!):

<?php
$content = "<?php/n
//############################{ .$_POST[\"img_name\"]. }###########################/n
if ($_REQUEST['id'] == '.$_POST[\"img_id\"].')
/n{
/n$img_url=\".$_POST[\"img_url\"].\"
/n$alt=\".$_POST[\"img_alt\"].\"
/n$name=\".$_POST[\"img_name\"].\"
/n$height=\".$_POST[\"img_height\"].\"
/n$width=\".$_POST[\"img_width\"].\"
/n$category=\".$_POST[\"img_category\"].\"
/n$release=\".$_POST[\"img_release\"].\"
/n$download=\".$_POST[\"img_download\"].\"
/n$version=\".$_POST[\"img_version\"].\"
/n}
/n?>";
$fp = fopen("image_info.php","wb");
fwrite($fp,$content);
fclose($fp);
?>