Little problem with form

17 posts by 3 authors in: Forums > CMS Builder
Last Post: April 9, 2010   (RSS)

By Jason - March 31, 2010

Hi,

You have an error in your header page. On lines 171 and 180 change the variable $productsRecord to $productsRecords.

Give that a try and let me know.
---------------------------------------------------
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: [Jason] Little problem with form

By thenetgirl - March 31, 2010

<form id="form" action="productsList.php">
<select name="product_type" class="dropdown" id="type" size="1" style="font-family: Garamond; color: #821789; font-size: 10pt" >
171----- <?php $options = getListLabels('products', 'product_type', $productsRecords['product_type']) ?>
<option>product type</option>
<?php foreach($options as $option): ?>
<option><?php echo htmlspecialchars($option) ?></option>
<?php endforeach ?> </select></td>
<td valign="top" width="6"><input src="buttons/greygo.gif" type="image" value="Search" name="I1"> </td></form>
<td valign="bottom" width="26">&nbsp;</td>
<td width="6" valign="top">
<form id="form" action="productsList.php">
<select name="treatment" class="dropdown" id="type" size="1" style="font-family: Garamond; color: #821789; font-size: 10pt" >
181 ---- <?php $options = getListLabels('products', 'treatment', $productsRecords['treatment']) ?>
<option>treatment</option>
<?php foreach($options as $option): ?>
<option><?php echo htmlspecialchars($option) ?></option>
<?php endforeach ?> </select></td>



still shows errors -
Notice: Undefined index: product_type in /home/skinsolu/www/skinsolutionsbymimi.com/include_header.php on line 171
Notice: Undefined index: treatment in /home/skinsolu/www/skinsolutionsbymimi.com/include_header.php on line 181
Patricia

www.thenetgirl.com

By Jason - March 31, 2010

Can you let me know what all of the field names are in the "products" table?
---------------------------------------------------
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: [Jason] Little problem with form

By thenetgirl - March 31, 2010

<h1>Products - List Page Viewer</h1>
<?php foreach ($productsRecords as $record): ?>
Record Number: <?php echo $record['num'] ?><br/>
Brand: <?php echo $record['brand'] ?><br/>
Product Type: <?php echo join(', ', getListLabels('products', 'product_type', $record['product_type'])); ?><br/>
Treatment: <?php echo join(', ', getListLabels('products', 'treatment', $record['treatment'])); ?><br/>
Product ID/SKU: <?php echo $record['product_id_sku'] ?><br/>
Name: <?php echo $record['name'] ?><br/>
Price: <?php echo $record['price'] ?><br/>
Size: <?php echo $record['size'] ?><br/>
Description: <?php echo $record['description'] ?><br/>
About Brand: <?php echo $record['About_the_product'] ?><br/>
Ingredients: <?php echo $record['ingredients'] ?><br/>
Directions: <?php echo $record['directions'] ?><br/>
_link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>


product_type

AHAs/ PHAs
Anti-Aging
Anti-Itch
Anti-Shine
Antioxidants
Baby Skin Care
Body Care
Cleansers
Deodorants
Exfoliants
Eyes- anti-aging
Firming
Hair Care
Make-up- Accessories
Make-up- Blush
Make-up- Brushes
Make-up- Concealers
Make-up- Eyes
Make-up- Lips
Make-up- Liquid Foundations
Make-up- Powder
Masks
Moisturizers
Nail Care
Peels & Polishers
Repair/Restorers
Skin Lighteners
Sunscreens
Toners

treatment list

Acne/ Acne Scarring
Aging
Blemishes
Chapped Lips
Combination Skin
Dark Spots/ Age Spots
Dermatitis-Rash
Dry or Scaly/Rough
Dry Skin
Dull Skin
Eczema
Light or White Spots
Normal Skin
Oily Skin
Photoaged/ Sun Damaged
Pre/Post Rejuvenating Procedures
Psoriasis
Rosacea
Scars
Sensitive Skin
Special Problems
Teenage Skin
Uneven Color
Patricia

www.thenetgirl.com

Re: [Jason] Little problem with form

By thenetgirl - April 2, 2010

any ideas on this suppose to go live next week and this is the last bug i have left



thanks
Patricia

www.thenetgirl.com

Re: [Donna] Little problem with form

By thenetgirl - April 9, 2010

Thanks Donna you were wonderful as always.

This was finally resolved the code is as follows

<?php

require_once "/cmsAdmin/lib/viewer_functions.php";

list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',

));

?>

<form id="form" action="productsList.php">
<select name="product_type">
<?php
$schema = loadSchema('products');
$fieldSchema = $schema['product_type'];
$fieldOptions = getListOptionsFromSchema($fieldSchema);

foreach ($fieldOptions as $valueAndLabel) {
list($value,$label) = $valueAndLabel;
$encodedValue = htmlspecialchars($value);
$encodedLabel = htmlspecialchars($label);
print "<option value=\"$encodedValue\">$encodedLabel</option>\n";
}
?>
</select>
<input type="submit">
</form>
Patricia

www.thenetgirl.com