siric
-
Posts
116 -
Joined
-
Last visited
Posts posted by siric
-
-
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>
-
Ok, so how do I wrap this all up into the page. For some reason when I add the results info it make my whole page design fall apart. I can post the example page here if that would help.
Post it
-
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. ...........
}
-
It was just a joke dude
I know...but thanks for the thumbs up!!!
-
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') {
-
showoff
Far from!!! I had to do some serious research and coding for that - I am NOT!!! a JS expert!!
-
so the code I posted didn't work then?
Yes, yours the HTML was fine, but i changed the javascript as well.
-
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')\" />"; ?>
-
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.
-
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.
-
Have a look at http://www.tripwiremagazine.com/2009/06/24-essential-submit-button-enhancements.html. Something there should work for you.
-
A while cannot be inside another while loop, as foreach cannot to.
Many thanks,
James.
James,
I think you are mistaken - you can place a while loop within another while loop.
-
Need the script for the form.
-
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>
-
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 ?
-
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.
-
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 ... } }
-
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??
-
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.
-
I am probably WAY off mark here, but wouldnt this also work?
$file_name = $file_name_array['0']; $new_name = str_replace($substr($file_name, -3, 3), 'flv', $file_name);
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.
-
Have a look at PHP Fusion www.php-fusion.co.uk
-
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') { ...... }
-
siric, md5 is not an encryption process; it's a hashing process.
Noted. Slip of the finger LOL.
-
Try OpenX http://www.openx.org/
Help with stripos
in PHP Coding Help
Posted
Tried it and works for me.