-
Posts
867 -
Joined
-
Last visited
Posts posted by uniflare
-
-
Im in the process of figuring this out.
btw gevans; head and body is there hes just putting the meta tags/link tags and title in the wrong place.
For the form, ill get back to you....
-
You can download "Free SMTP Server"s, they are like messengers, you ust click and install the server, and make sure ur php.ini smtp.path or w/e it is, is set to localhost.
Most free smtp server software is buggy and unreliable.
The other option would be to use a Mailer class library like PHPMailer to use authentication, you can use googles smtp server to send data to other emails then.
-
gevans, he stated his version. but yes you could try request to see if the data is being accidentall sent threough the URL. via _GET.
OR;
save this to test.html (change ACTION_HERE to the URL of the buggy script).
<form method="post" action="ACTION_HERE"> <input type="text" name="text_input"><br /> <input type="checkbox" value="Check1"><Br /> <input type="submit" value="Submit Form"> </form>
view test.html in any browser (does not have to be off server can just double click the file.), and see if it has any post data then.
-
This will fail if you dont select at least 1 checkbox. (implode failure).
to fix this:
$and_ornull = (count($_POST['criteria']) >= 1)? " AND" : ""; $find2[] = $and_ornull." `".$Key."`='".$Value."'";
Basically you only need the AND if there is at least 1 other search or 'where' term, so if any checkboxes are selected, then add the AND.
----------
The implode function will still fail like this.
You should put all the search elements into a single array (Add criteria to find2), then implode them all at once to fix this.
-
There is something ouve missed or not told us,
The page is not recieving any post information. at all. as if your not submitting the form to that page.
make a normal html document, put the action to the URL of the buggy script, post any data with the var dump or print r at the top of your page. you should.
Apart from;
$_POST var being reset,
accidentally posting URL arguments ($_GET);
Old version of PHP (other scripts wouldnt work).
there shud be no possible explanation why there is no post data. the other pages accept post data fine.
-
hmm, the implode shud of been unchanged.
try changing the name of the form array to something like data_arr, eg:
form[venue]
to
data_arr[venue]
etc
-
try putting print_r($_POST); at the top of ur pages, then use the source viewer to look at the results.
-
read the page they gave you.
specifically at Example #4: Sending HTML email
-
He means: He does not know how to use select boxes.
So, you've got some code already, give us ur code so we can see how much you kinda know already.
-
Ok, im going to end this im afraid, if you dont understand the code have a good look through.
To save time and page space, and me repeating myself again (no offense), here's the code that shud work:
<?php print "<link href='/skins/Cobalt/Cobalt.css' rel='stylesheet' type='text/css' media='screen'>"; require('include/jamroom-include.inc.php'); require_once('zipcode.class.php'); // zip code class // FUNCTIONS Function array_limit($array,$start,$length){ $return_array = array(); for($i=$start;$i<($start + $length);$i++){ $return_array[] = $array[$i]; } return $return_array; } // creates a url without destroying the current one. (keeping it on the same page with the same values). function make_url($id_list){ if(!is_Array($id_list)){ echo("error, function make_url(arg), arg should be an array."); return; } // add each element foreach($id_list as $id_str=>$id_val){ if($id_val === false){ // must use ===, since if you use ==, then 0, false, and null mean the same thing. $url = (!isset($url))? null : $url; $url = str_replace( array( "&".$id_str."=".@$_GET[$id_str], $id_str."=".@$_GET[$id_str]."&", $id_str."=".@$_GET[$id_str] ), "", $url ); }else{ // For the loop $url = (!isset($url))? $_SERVER['REQUEST_URI'] : $url; // if page is alread in the url somewhere get rid of it (or we will have lots of them,). $url = (isset($_GET[$id_str]))? str_replace( array( "&".$id_str."=".@$_GET[$id_str], $id_str."=".@$_GET[$id_str]."&", $id_str."=".@$_GET[$id_str] ), "", $url ) : $url; // the : colon is like the }else{ part of an if statement. $preq = (substr($url,-1) != "?")? "?" : ""; // if there is already arguments u need to add the &, otherwise you need to add the ?. $url = ((count($_GET) == 1 && isset($_GET[$id_str])) || count($_GET) == 0)? $url.$preq.$id_str."=" : $url."&".$id_str."=".$id_val; } } return $url; } // END FUNCTIONS // GRAB ZIPS $z = new zipcode_class; $zips = $z->get_zips_in_range($_POST['zip_code'], $_POST['miles'], _ZIPS_SORT_BY_DISTANCE_ASC, true); // add searched for zip to $zips array $zips[$_POST['zip_code']] = 0; // make sure this is a multiple of $entriesperline; $rowsperpage = 16; // 4x4 grid - u can change this variable to change how many each page, without having to change any of the other code. $entriesperline=4; // PAGE VARIABLES $prev = make_url( array( "page"=>@$_GET['page'] - 1 ) ); $next = make_url( array( "page"=>@$_GET['page'] + 1 ) ); // Figure which row to start from. $startrow = (isset($_GET['page']) && $_GET['page'] != 0)? ($_GET['page'] - 1) * $rowsperpage : 0; // this is just to initialise the variable: $result_array = array(); // Take only the result for this page... $zips = array_limit($zips,$startrow,$rowsperpage); // first we gather all the results into a single array: foreach ($zips as $key => $value){ //find all locations within range using returned zipcode values $sql_events = mysql_query("SELECT * FROM jamroom_band_info WHERE band_zipcode='$key' ORDER BY band_update DESC LIMIT 1"); while ($row = mysql_fetch_array($sql_events)) { // we just add this row to the array: $result_array[] = $row; } } // Used for Modulus $counter=1; print "<table>"; // loop through each result row. $i = 0; // debug? foreach ($result_array As $row){ if($counter%$entriesperline==1 && $i < 50){ print "<tr><td align='center'><div class='body-zip'><a href=\"members/{$row['band_id']}\">{$row['band_name']}</a><br><a href=\"members/{$row['band_id']}\"><img border='0' src=\"image.php?band_id={$row['band_id']}&mode=band_image&width=100&theme=Sage\">{$row['band_image']}</a></div></td>"; }else if($counter%$entriesperline==0 && $i < 50){ print "<td align='center'><div class='body-zip'><a href=\"members/{$row['band_id']}\">{$row['band_name']}</a><br><a href=\"members/{$row['band_id']}\"><img border='0' src=\"image.php?band_id={$row['band_id']}&mode=band_image&width=100&theme=Sage\">{$row['band_image']}</a></td></div></tr>"; }else if($i < 50){ print "<td align='center'><div class='body-zip'><a href=\"members/{$row['band_id']}\">{$row['band_name']}</a><br><a href=\"members/{$row['band_id']}\"><img border='0' src=\"image.php?band_id={$row['band_id']}&mode=band_image&width=100&theme=Sage\">{$row['band_image']}</a></div></td>"; } $counter++; $i++; } //exit loop if($counter%$entriesperline!=0){ print "</tr>"; // Add my big function i told you about earlier to fix this header/footer problem. echo("<a href=\"$prev \">Prev</a> | ".htmlentities($_GET['page'])." | <a href=\"$next\">Next</a>"); } print "</table>"; ?>
TAKE NOTE OF WHERE I PUT EVERYTHING, and figure out why.
Thank you, and good night .
-
if page = 1, (page 1).
$startrow would equal 1 + 1 * 16, 2 * 16, 32. if you started on row 32 ou would miss the first 32 rows! it does not make sense that way.
-
? this shud not work at all.........
-
ok i would use arrays, like youve done on the checkboxes.
eg:
in the form you use:
<input type="text" name="form[username]" value="somevalue">
this way you can do this:
mysql_select_db($database_connuser, $connuser) or die; $find2 = array(); // rid us of those e_notice's. foreach($_POST['form'] As $Key=>$Value){ $find2[] = " AND `".$Key."`='".$Value."'"; } $find = implode("=1 AND ",$_POST['criteria'])."=1"; $query = "select * from drinking where $find.$find2 order by venue asc";
-
you sure its working, that final code seems wrong still
-
sorted, phew!
Im glad its all working now .
-
Yes exactly, give us the code you got atm.
-
$zips = array_limit($zips,$startrow,$rowsperpage);
needs to be moved.
-
correct! thats 1 down!
-
Ok, you need to understand where to put the code i gave you. You need to understand this its very basic so im only going to give you hints im afraid, dont worry though, you will hit yourself once u figure it out.
You need to move a variable i mentioned earlier.
and you need to move the $zips = array_limit.... line, the function code can be put anywhere (i put all my functions in a seperate file but i suggest putting them at the top at least).
Read through and follow your code line by line. you can use echo() and print_r() (for arrays), to see what the value of each variable is at a specific point in the script - it really helps.
-
I think to try keep things simple, why is it important that data is not inserted between those queries?
Give us an example situation where this would be a problem, maybe there is a better method.
lock tables, you will have to lock, then unlock straight away, thats 4 queries in total, unless those 2 queries are seconds apart, it wont make a difference.
-
if ur making a config file, just make the first page of the install file -> the creation of the config file...
Page 1-> Enter Configuration into a form, submit....
Page 2-> Save Configuration silently using fopen/fwrite/fclose, then include() the file, install the script.
-
the reason is the $zips array contais the list of zip codes found near that user, these zip codes are basically what you are displaying on ur tables, the mysql query is only there to get "more detailed" information about those zip codes.
when you use a foreach, it s a For Each Zip Code.... Grab its single row.... since you cannot limit a single row, theres no need. you are getting the original "Rows" from the zip code function. all your doing with mysql is getting more information for each of those rows.
Hope this helps clear things up.
-
cookies cannot be used on the same execution that created them. use either a Header("location: ./url.php"); redirection, or log them in as you create the cookie, (rather than relying on the cookie to be there).
-
lol then the computers ip's hasnt changed in years, thats pretty remarkable in itself .
[SOLVED] Voting system not working anymore
in PHP Coding Help
Posted
Hmm, it seems i cannot debug any further, your server will not accept POST variables sent from an outside address, so i cant mess around with the form.
Basically, put this into test.html:
Then, keep trying to post data from it, start with just leaving the form tags and the form elements, if that works then you know its something on the page; and you can start putting bits back in line b line until you find whats causing it.
the fact that the small test.html works shows that there is something wrong with the way its posting data, maybe a server restriction bug (never seen this restriction b4), or just something in your html markup is messing up the form - you need to find out what it is.
Good Luck.