UploadAddForm.php

4 posts by 2 authors in: Forums > CMS Builder
Last Post: November 5, 2012   (RSS)

Hi,

When I upload a file to the form, the options I have already selected from the dropdowns are reset.

Is there a way I can get the options to save once the file has been uploaded? The data already entered into my text fields are being saved fine.

I am inserting the dropdowns using the following code:

<select name="currency">
<?php echo $optionsCurrency ?>
</select>



Thank you,
Greg

Re: [gversion] UploadAddForm.php

By Jason - November 1, 2012

Hi Greg,

Could you please attach UploadAddForm.php so we can take a look at your current code?

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [gversion] UploadAddForm.php

By Jason - November 5, 2012

Hi Greg,

I see. So the problem is maintaining the values in your dropdown fields after an image has been uploaded. Is that right?

If so, here is a different method to getting list field information that may help keep your code a little cleaner. It uses the getListOptions() function.

For example, here is how you can set up your category drop down:

<select name="category">
<option value = "">-Select-</option>
<?php foreach (getListOptions($tableName, 'category') as $value => $label): ?>
<option value = "<?php echo htmlspecialchars($value);?>" <?php selectedIf($value, @$_REQUEST['category']);?>> <?php echo htmlspecialchars($label);?> </option>
<?php endforeach ?>
</select>


The selectedIf() function sets the selected = "selected" attribute of any option that matches what is currently in the category field of the $_REQUEST array.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/