Jump to content

ricardogarcia

Members
  • Posts

    4
  • Joined

  • Last visited

ricardogarcia's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. **Question** | **This is really all i'm trying to do..**-------------------------------------------------------------------------------------------simply....if the user picks a zipcode from $loc1 then image $image1(nextday) will show...if user pick a zipcode from $loc2 than $image2(2nd-Day)will hopefully appear under the search box..i hope that no page "redirect" is necessary... since images are displayed under search box area...-------------------------------------------------------------------------------------------**Problem** | **So far here's what happens..**-------------------------------------------------------------------------------------------and....ok, one issue is; when test the form in the internet browser the images are displayed right of way before the submit button has been clicked, i'm not sure if it's a problem with using the "in_array"also, any special way to code php with html too: make a image appear directly under the search box?-------------------------------------------------------------------------------------------**<?php**$zipcode = $_POST['zipcode'];$loc1 = array (80013,80015,80126,80127,80128,80129,80130,80134,80135,80138,80160,80161,80162,80163,80165,80166,804 33,80453,80465,80470);$loc2 = array (80023,80025,80136,80137,80138,80139,80140,80144,80145,80148,80140,80141,80142,80143,80145,80146,804 43,80443,80445,80440);$image1 = '<img src="Section-Images/Section-Edits/1st--Day-img.png" alt="1st--Day.png/>';$image2 = '<img src="Section-Images/Section-Edits/2nd--Day-img.png" alt="2nd--Day.png" />';$image3 = '<img src="Section-Images/Section-Edits/2-3--Day.png" alt="2-3--Day.png" />';if (in_array($zip, $loc1)) {echo "<div class='banner'><img src='Section-Images/Section-Edits/Next--Day-img.png' /></div>Count: $i = $displayitem[$i] ";}else if (in_array($zip, $loc2)) {echo "<div class='banner'><img src='Section-Images/Section-Edits/2nd--Day-img.png' /></div>Count: $i = $displayitem[$i] ";}else {echo "<div class='banner'><img src='Section-Images/Section-Edits/2-3--Day.png' /></div>Count: $i = $displayitem[$i] ";}exit();?>**HTML form:**<html><div class="panel"><div class="panel-content"><form id="zipcode" action="<?php echo $_SERVER['PHP_SELF']; ?>" method='POST'><input type='text' size="6" maxlength="5" id='searchbar' class='searchbar2'name='zipcode'><input type='submit' value='Search' onclick="submitclick(); return false;" id='submitbutton'class='zipcode_button'></div></form></html>
  2. The part of the code that i'm having issues is that if; i load the page in browser, it displays some of the php code and image on top of template, (if(in_array($zipcode, $loc1)) { echo $image1; $width = 100; $height = 662; } else if(in_array($zipcode, $loc2)) { echo $image2; $width = 100; $height = 662; } else { echo $image3; $width = 100; $height = 662; $form['#zipcode'] = FALSE; exit(); } ?>) i'm not to sure if the code is correct but, ...i'm really just trying to shape the code just to do the following described, " if the user picks a zipcode from $loc1 then image $image1(nextday) will show... if user pick a zipcode from $loc2 than $image2(2nd-Day)will hopefully appear under the search box.. " thanks very much
  3. This is really all i'm trying to do.. simply....if the user picks a zipcode from $loc1 then image $image1(nextday) will show... if user pick a zipcode from $loc2 than $image2(2nd-Day)will hopefully appear under the search box..i hope that no page "redirect" is necessary... since images are displayed under search box area...
  4. Okay here is what I'm trying to do...--------------------------------------------------primary function of what I'm trying to do-----------------------------------------------------------simply....if the user picks a zipcode from $loc1 then image $image1(nextday) will show... if user pick a zipcode from $loc2 than $image2(2nd-Day)will hopefully appear under the search box..i hope that no page "redirect" is necessary... since images are displayed under search box area...---------------------------------------------------------------------PHP--Form-------------------------------------------------------------------------------<?php$zipcode = $_POST['zipcode'];$loc1 = array (80013,80015,80126,80127,80128,80129,80130,80134,80135,80138,80160,80161,80162,80163,80165,80166,804 33,80453,80465,80470);$loc2 = array (80023,80025,80136,80137,80138,80139,80140,80144,80145,80148,80140,80141,80142,80143,80145,80146,804 43,80443,80445,80440);// need to add whatever validation/sanitation of zip code value here $image1 = '<img src="Section-Images/Section-Edits/1st--Day-img.png" alt="1st--Day.png/>'; $image2 = '<img src="Section-Images/Section-Edits/2nd--Day-img.png" alt="2nd--Day.png" />'; $image3 = '<img src="Section-Images/Section-Edits/2-3--Day.png" alt="2-3--Day.png" />';if(in_array($zipcode, $loc1)) {echo $image1;}else if(in_array($zipcode, $loc2)) {echo $image2;}else {echo $image3;$form['#zipcode'] = FALSE;exit();}?>---------------------------------------------------------------------PHP--Form--End----------------------------------------------------------------------------------------------------------------------------------------------HTML--Form-------------------------------------------------------------------------------<div class="panel"><div class="panel-content"><form id="zipcode" action="<?php echo $_SERVER['PHP_SELF']; ?>" method='POST'><input type='text' size="6" maxlength="5" id='searchbar' class='searchbar2'name='zipcode'><div id="actions"><input type='submit' value='Search' onclick="submitclick(); return false;" id='submitbutton' class='zipcode_button'><td><id="zipcodeError" value='' class="zipcode_button"/></td></div></form></html>---------------------------------------------------------------------HTML--Form--End----------------------------------------------------------------------------
×
×
  • Create New...