Jump to content

siric

Members
  • Posts

    116
  • Joined

  • Last visited

Everything posted by siric

  1. Note that you had a few places where tags where closed but had not been opened eg <p>Search by Zip:</font></b> Also am not sure why you are using a Z-index?? This is usually use when you want one area to appear to be in front of another. Anyway, give this a try. <table width="950" height="490" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="47" bgcolor="efe9e3"><div align="center"><img src="950/top-block2.png" width="161" height="47" /></div> <td width="775" rowspan="2" valign="top" bgcolor="#FFFFFF"><p class="style1"><img src="direct-assets/Sl-tag.jpg" alt="" width="745" height="59" /> </p> <p class="style1"><span class="style5"><strong>Please use the form below to locate a retailer near you.</strong></span></p> <table width="700" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="371" valign="top" class="PHP-area"> <?php if(!isset($_POST['submit'])){ ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <label for="zip">Search by Zip:</label><div><input type="text" name="zipCode" size="20" class="input-box" /> <b>(example: 01922)</b></div> <br/> <label for="state">Search by State:</label><div><input type="text" name="state" size="20" class="input-box" /> <b>(example: NY for New York)</b></div><br/> <input type="submit" name="submit" value="Go"> </form> </td></tr></table> Have a look at this page as well for some guidelines http://css-tricks.com/label-placement-on-forms/
  2. Once formatting is screwed you know that it is a CSS issue. if you want to post that, I can have a look.
  3. Tried it and works for me.
  4. Try this. As I do not have your CSS file, I cannot get the styling exact, but you should be able to get through that. Also, define all of your classes in the CSS file and replace <p align="left" style="margin-top: -1; margin-bottom: -1"> with <p class="whatever"> //CSS file .whatever { text-align= left; margin-top: -1; margin-bottom: -1 } This will make your code easier to read and the formatting easier to change when ever you need to. <body> <?php if(!isset($_POST['submit'])){ ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <p align="left" style="margin-top: -1; margin-bottom: -1"> <span class="style2"><b><font size="2">Search by Zip:</font></b> <input type="text" name="zipCode" size="20"> <b><font size="2">(example: 01922) </font></b></span></p> <p align="left" style="margin-top: -1; margin-bottom: -1"> <span style="font-family: Arial, Helvetica, sans-serif"><br> <font size="2"><b>Search by State: </b></font> <input type="text" name="state" size="20"> <b> <font size="2">(example: NY for New York) </font></b></span> <input type="submit" name="submit" value="Go"> </form> <?php } else { // Page two, search and display $connect = mysql_connect("localhost", "root", "sysadmin"); $db = mysql_select_db("test", $connect); $sql = "SELECT * FROM STOREDATA WHERE State = '".$_POST['state']."' OR ZIP_Code = '".$_POST['zipCode']."'"; $result = mysql_query($sql); $rows = mysql_num_rows($result); if($rows > 0) { echo "<p><center></p> <table border=\"1\"> <th align=\"center\newstyle\">Name</th> <th align=\"center\">City</th> <th align=\"center\">State</th> <th align=\"center\">Sales Phone</th>"; while($row=mysql_fetch_array($result)) { echo "<tr><center> <td align=\"center\" class=\"newstyle\">".$row['Name']."</td> <td align=\"center\" class=\"newstyle\">".$row['City']."</td> <td align=\"center\" class=\"newstyle\">".$row['State']."</td> <td align=\"center\" class=\"newstyle\">".$row['Sales_Phone']."</td> </tr>"; } } else { echo "No results found"; } mysql_close($connect); ; } ?> </body>
  5. Very possible. if (isset(submit)) { //This checks to see if the submit button is set //process query } else { //Show form ....... <FORM name="search" action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post" > //This calls itself when the submit if clicked. ........... }
  6. I know...but thanks for the thumbs up!!!
  7. There is no need to js. In the <form> line use <FORM name="feature" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" > This will cause the page to reload itself. Also where do you load the variables user->credits which is used in this line ? if($user->credits < '1000') {
  8. Far from!!! I had to do some serious research and coding for that - I am NOT!!! a JS expert!!
  9. Yes, yours the HTML was fine, but i changed the javascript as well.
  10. Tested this and it works. <script type='text/javascript'> function disp_confirm(companyid) { var c = confirm('Do you really want to archive this company?'); if (c == true) { window.location.href = 'companies.php?action=Archive&companyid='+companyid; } } </script> <? $companyid = '1'; echo "<input type='image' src='blue.png' onclick=\"disp_confirm('$companyid')\" />"; ?>
  11. Ok, Have done some further research and have come up with this so far. The main problem seems to be the image for the form button. If you do not use an image and use window.location, it works. function disp_confirm(companyid) { var c = confirm('Do you really want to archive this company?'); if (c == true) { var link='companies.php?action=Archive&companyid='+companyid; window.location=link; //could also be // window.location = 'companies.php?action=Archive&companyid='+companyid; } } and html echo "<input type='button' value='Redirect' onclick=\"disp_confirm('$companyid')\">"; Will chk further on the image as button option.
  12. I moved around the code a bit as function disp_confirm(companyid) { var c = confirm('Do you really want to archive this company?'); if (c == true) { var link='companies.php?action=Archive&companyid='+companyid; alert(link); } } The alert shows that the correct url is passed to link variable. It would be just a matter of getting that into the URL.
  13. Have a look at http://www.tripwiremagazine.com/2009/06/24-essential-submit-button-enhancements.html. Something there should work for you.
  14. James, I think you are mistaken - you can place a while loop within another while loop.
  15. You need to find out how many rows the query has returned and then loop through the results. Pseudo Code $number_of_rows = mysql_num_rows($sql_eventos) //Get number of rows returned <select> for ($count=0; $count< $number_of_rows; $count++) { <option value........> } </select>
  16. Break down $query = sprintf ("INSERT INTO album (date, name, desc) VALUES ('$date', '$name', '$desc')"); $result = mysql_query ($query); // Her stopper det tipper jeg to $query = "INSERT INTO album (date, name, desc) VALUES ('$date', '$name', '$desc')"; print $query; $result = mysql_query ($query); // Her stopper det tipper jeg This will allow you to look at the query statement to ensure that it is correct and to run it directly against the database. Also, why are you using sprintf ?
  17. Ok, Went through it in detail and this works. Don't even need arrays - my bad. $max_number_of_cats = 10; for ($count = 1; $count < $max_number_of_cats+1; $count++) { //start number for count is the first cat number $sql = "SELECT * FROM photo WHERE photo_category='$count' ORDER BY photo_id DESC"; $result= mysql_query($sql); $num_rows = mysql_num_rows($result); if ($num_rows > 0) { //If there is a result for the cat search, then display the divs //Start div here for ($i=0; $i<$num_rows;$i++) { $photo_id=mysql_result($result, $i, "photo_id"); $photo_caption=mysql_result($result, $i, "photo_caption"); $photo_filename=mysql_result($result, $i, "photo_filename"); $photo_category=mysql_result($result, $i, "photo_category"); $photo_colour=mysql_result($result, $i, "photo_colour"); print "Photo - $photo_id - $photo_caption - $photo_filename - $photo_color - $photo_category<br/>"; } print "Cat Change<br/><br/>"; //end your div here } } Try that and let me me know.
  18. You would need to use an array for the categories. Find out how many categories you have and define an array - $cat = array(); for ($count = 1; $count < $max_number_of_cats+1; $count++) { $result = mysql_query( "SELECT photo_id,photo_caption,photo_filename FROM art_photos WHERE photo_category='".addslashes($cat[$count])."' ORDER BY photo_id DESC" ); //cat[$count] here would equate to cat1 in the first instance, cat2, etc. if ($result) { //If there is a result for the cat search, then display the divs ... //make div and display ... } }
  19. Question is, if you always want to select the value "239" and always want to input the same text, why do you need a form??
  20. Whenever I get into problems with variables, I just validate them by assigning $_POST variables to a normal var and printing them. So as Muddy_Funster has suggested, assign the POST to $date and do a print afterwards to ensure that it is correct. Also, note that your entry field allows free text, so unless you are using this yourself, it can lead to problems, as users can enter the date in any format.
  21. You do not even have to place the name in an array to do it this way. Simply $file_name = 'myvideo.avi'; $new_name = str_replace(substr($file_name, -3, 3), 'flv', $file_name); That would work. The limitation here is that it will only work with file extensions of 3 characters in length. And remember, no $ in front of the substr function name.
  22. Works for me. What I would do however is to use the same name for the submit button, but only change the value <input type="submit" name="submit" id="tilbake" value="Back" /> <input type="submit" name="submit" id="lagre" value="Finished" /> <input type="submit" name="submit" id="publiser" value="Publish" /> Then in the preview.php $selection = $_POST['submit']; if ($selection == 'Back') { ... } elseif ($selection == 'Finished') { ..... } elseif ($selection == 'Publish') { ...... }
×
×
  • 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.