Jump to content

solonman123

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by solonman123

  1. Hi Everyone! Just learning php. Hope someone can help with this. Trying to design a product page of photo images with price, description, etc. At this point I am ignoring the design and just trying to get the fields to populate. They all work through my "while" loop except I cannot find the syntax for the image and am just getting the placeholder. My images are just "image".jpg in my root folder. Ex. building.jpg. And my table column is "picture_image". Appreciate any help. Here is the pertinent code which works fine except for the image $ROW. I have bolded the trouble block. Thanks! while($row = mysqli_fetch_assoc($result)) { // display row for each picture echo "<tr>\n"; echo " <td>{$row['Picture_ID']}</td>\n"; echo " <td style='font-weight: bold; font-size: 1.1em'>{$row['Picture_name']}</td>\n"; echo " <td>{$row['Picture_description']}</td>\n"; echo " <td>{$row['Picture_price']}</td>\n"; echo "<td><a href={$row['picture_image']}' border='0'> <img src='{$row['picture_image']}' border='0' width='100' height='80' /> </a></td>\n";
  2. Hi everyone. My first post here. I am a beginner and have created a contact form. Unfortunately, My "province_state" variable value does not retain the selection. I would really appreciate some help in solving this. Here is the link to my php file. http://barrytowns.com/php/lesson_four_customer_data.php And here is the code to my include file. I have commented on line 133 that /* THIS IS WHERE MY PROBLEM IS */ to indicate the following block of echo commands. I know I am getting something in the wrong place or order but trial and error has not given me the solution. Thanks to anyone who can lend me a hand... <?php /* Program name: lesson_four_customer_data.inc * Description: Defines a form that collects customer data for shipping and marketing purposes. */ $labels = array( "last_name" => "Last Name", "first_name" => "First Name", "street_address" => "Street Address", "city" => "City", "province_state" => "Province or State", "country" => "Country", "postal_zip_code" => "Postal code or Zip", "phone_number" => "Phone number", "email" => "Email"); $province_state = array ( "UNITED_STATES"=>"US", "Alabama" => "AL", "Alaska" => "AK", "Arizona" => "AZ", "Arkansas" =>"AR", "California" =>"CA", "Colorado" =>"CO", "Connecticut" =>"CT", "Delaware" =>"DE", "District_of_Columbia" =>"DC", "Florida" => "FL", "Georgia" =>"GA", "Hawaii" =>"HI", "Idaho" => "ID", "Illinois" =>"IL", "Indiana"=>"IN", "Iowa" => "IA", "Kansas" =>"KS", "Kentucky" =>"KY", "Louisiana" =>"LA", "Maine" =>"ME", "Maryland" =>"MD", "Massachusetts" =>"MA", "Michigan" =>"MI", "Minnesota" =>"MN", "Mississippi" =>"MS", "Missouri" =>"MO", "Montana" =>"MT", "Nebraska" =>"NE", "Nevada" =>"NV", "New_Hampshire" =>"NH", "New_Jersey" =>"NJ", "New_Mexico" =>"NM", "New_York" =>"NY", "North_Carolina" =>"NC", "North_Dakota" =>"ND", "Ohio" =>"OH", "Oklahoma" =>"OK", "Oregon" =>"OR", "Pennsylvania" =>"PA", "Rhode_Island" =>"RI", "South_Carolina" =>"SC", "South_Dakota" =>"SD", "Tennessee" =>"TN", "Texas" =>"TX", "Utah" =>"UT", "Vermont" =>"VT", "Virginia" =>"VA", "Washington" =>"WA", "West_Virginia" =>"WV", "Wisconsin" =>"WI", "Wyoming" =>"WY", "CANADA"=>"Cd", "Alberta" =>"AB", "British Columbia" =>"BC", "Manitoba" => "MB", "New Brunswick" => "NB", "Newfoundland" =>"NF", "Northwest Territories" =>"NT", "Nova Scotia" => "NS", "Nunavut" =>"NU", "Ontario" => "ON", "Prince Edward Island" =>"PE", "Quebec" =>"QC", "Saskatchewan" => "SK", "Yukon Territory" => "YT"); $submit = "SUBMIT"; ?> <html> <head> <link href="all_over.css" rel="stylesheet" type="text/css"> <style type='text/css'> <!-- form { margin: 1.5em 0 0 0; padding: 0; } .field {padding-bottom: 1em;} label { font-weight: bold; float: left; width: 20%; margin-right: 1em; text-align: right; } .submit { margin-left: 35%; } h3 { font-family: arial; text-align: center; } label { font-family: arial; font-size: 14px; } --> </style> </head> <body> <h2>Please fill out the form below to register with</h2> <h1>SWAMPLAND PHOTOGRAPHY </h1> <?php /* THIS IS WHERE MY PROBLEM IS */ echo "<form action='$_SERVER[php_SELF]' method='POST'>"; foreach($labels as $field => $label) if($field == "province_state") { echo "<div class='field'><label for='$field'>$label</label>"; echo"<select name='province_state'>"; foreach($province_state as $value => $province_state_abr) { echo"<option value='$province_state_abr'>"; if($_POST['province_state'] == $province_state_abr) { echo " selected='selected'"; }">"; echo"$province_state_abr"; echo"</option>"; } echo"</select>"; echo"</div>"; } else { echo "<div class='field'><label for='$field'>$label</label> <input id='$field' name='$field' type='text' value='".@$$field."' size='50%' maxlength='65' /></div>"; } echo "<input type='hidden' name='submitted' value='yes'>"; echo "<div id='submit'> <input type='submit' name='SUBMIT' value='$submit'></div>"; ?> </form> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.