I have produced a simple form that allows users to upload an article + article image. My form consists of two text entry fields for title and article text + an file upload box for an article to accompany the article.
I used the form wizard to generate the html code which looks like:
My on submit code is as follows:
This php block is hacked together from bits I have found on the forum the text is being parked in jos_content but the image is not being included. I would be most grateful if anybody could offer help with my image problem 😟
I used the form wizard to generate the html code which looks like:
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Click Me to Edit</label>
<input class="cf_inputbox" maxlength="150" size="30" title="" id="text_0" name="text_0" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 150px;">Click Me to Edit</label>
<textarea class="cf_inputbox" rows="3" id="text_1" title="" cols="30" name="text_1"></textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Submit" name="button_0" type="submit" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_fileupload">
<label class="cf_label" style="width: 150px;">Click Me to Edit</label>
<input class="cf_fileinput cf_inputbox" title="" size="20" id="file_9" name="file_9" type="file" />
</div>
<div class="cfclear"> </div>
</div>
My on submit code is as follows:
<p><span style="color: #0000ff;"><strong>Thank you for submitting your nominee entry. We will review it shortly and if approved it will be published.</strong></span></p>
<p><span style="text-decoration: underline;"><strong>Admin.</strong></span></p>
<?php
$introtext = JRequest::getVar('text_1');
$introtext = str_replace('{file_9}', '<p><img src="/home/welshart/public_html/newsimages/'.JRequest::getVar('file_9').'" target="_blank" ></p>', $introtext);
$_POST['catid'] = '8';
$_POST['id'] = '';
$_POST['sectionid'] = '3';
$_POST['state'] = '1';
$_POST['created'] = date("Y-m-d H:i:s");
$_POST['title'] = $_POST['text_0'];
$_POST['introtext'] = $introtext;
?>
This php block is hacked together from bits I have found on the forum the text is being parked in jos_content but the image is not being included. I would be most grateful if anybody could offer help with my image problem 😟