taquitosensei
Members-
Posts
676 -
Joined
-
Last visited
-
Days Won
2
Everything posted by taquitosensei
-
I wouldn't put any spaces before the <?php that could cause problems further on down the road in case you ever need to send headers. That would stop you in your tracks. You can add whitespace after <?php all you want. Just not before.
-
as far as I know you're either getting or posting. Not both. So you'd have to adjust the receiving page to use POST instead of get.
-
What's on lines 1,2 and 3 of tap_functions.php?
-
part of the problem might be that you're spelling color two different ways. Because from what you've posted that would work. Except I would do <option value="" selected="selected">Choose a colour</option> <option value="red">Red</option> <option value="blue">Blue</option> <option value="orange">Orange</option> <option value="green">Green</option> <option value="white">White</option> <option value="yellow">Yellow</option> <option value="purple">Purple</option> <option value="brown">Brown</option> <option value="black">Black</option> then $colors=array("red","blue","orange","green","white","yellow","purple","brown","black"); // whitelist the colors for security if(isset($_POST['user_color']) && in_array($_POST['user_color'],$colors)) { echo "<body style='background-color: ".$_POST['user_color'].";'</body>"; }
-
do hidden forms for your get variables then pass those in the post example yoururl.com?field1=blah <form action='' method='post'> <?php foreach($_GET as $k=>$v) { echo "<input type='hidden' name='".$k."' value='".$v."'>"; } </form>
-
try escaping your foodtype WHERE f.name='".mysql_real_escape_string)$_GET['foodtype']."'";
-
that's straight from phps documentation. nm I just read your post all the way through. You'll probably have to use a callback function to increment your $replacement.
-
just add $count as the 5th string=preg_replace($word_to_replace, $replacement, $string,-1, $count); // -1 is no limit
-
IIS is not setup to parse php so instead of actually doing something with it it just spits it out as text. Here's a site looks like it does a pretty good job walking you through getting it configured http://www.plus2net.com/php_tutorial/php_iis_installation.php
-
It would help if we had the error message. This is the equivalent of..."It don't work"
-
Plus if it's html it's actually <br> not \r\n
-
It all depends on where the output is going to be outputted ( is that even a word? ) If it's html then $message.="<b>First Name</b>: ".$first_name."\r\n"; if it's plain text like in an e-mail I think you're out of luck. You could do html formatted e-mail though and use the above. Also it's supposed to be \r\n not \n\n unless you are looking for a double carriage return. in which case I would use \r\n\r\n
-
Pagination with columns! (I have been trying this for hours!)
taquitosensei replied to ThunderLee's topic in PHP Coding Help
that was just an example you have to replace the values with your own. while($s = mysql_fetch_array($result)) { would replace this foreach($resultset as $result) { you would define $counter before that. the variables don't exist in your script. then this print " <td width=\"275\" valign=\"top\" align=\"center\"><a target=\"_top\" href=\"media.php?v=".$s['musicid']."\">"; echo "<img src=\"$s[musicalbumart]\" width=\"90\" height=\"90\" border=\"0\" align=\"center\"><br> <div id=\"content\" align=\"center\">".$s['musictitle']."<br>".$s['musicartist']."</a><br>".$s['musicrating']."</div><br></td>"; would replace the <td>".$dataset."</td> you have to think about it people aren't going to want to help if you don't do a little thought process of your own and at least try to figure it out first. You just copy and pasted. -
Pagination with columns! (I have been trying this for hours!)
taquitosensei replied to ThunderLee's topic in PHP Coding Help
get your pagination script working first without the columns. Then for the columns do this $counter=1; echo "<table>"; echo "<tr>"; foreach($resultset as $result) { echo "<td>".$displayedresults."</td>"; if($counter%3==0) { echo "</tr><tr>"; } $counter++; } echo "</tr>"; echo "</table>"; -
[SOLVED] Need help working with flat text file to display data
taquitosensei replied to husslela03's topic in PHP Coding Help
this should do it <td><?php echo (is_numeric($data[3]) && is_numeric($data[4]) && is_numeric($data[5]))?sprintf("%1\$.2f", ((($data[3]+$data[4]+$data[5])/3)/1)).'%':""; ?></td> -
$loop3 = mysql_query("SELECT * FROM $row[0] ORDER BY date02") or die ('Cannot select table fields'); // SELECT ALL CONTENT FROM EACH TABLE mysql_data_seek($loop3,0); // RESET DATA COUNTER SINCE WHILE LOOP HAS ALREADY BEEN USED while ($row3 = mysql_fetch_array($loop3)){ $date = $row3[date02]; // LIST EACH OCCUPIED DATE IN FORMAT THAT MATCHES CALENDAR JQUERY FORMAT $date_a = substr ($date, 0, 4); // PULL YEAR AS SEPERATE VARIABLES SO THEY CAN BE REARRANGED TO FIT CALENDAR FORMAT $date_b = substr ($date, 4, 2); // PULL MONTH AS SEPERATE VARIABLES SO THEY CAN BE REARRANGED TO FIT CALENDAR FORMAT $date_c = substr ($date, 6, 2); // PULL DAY AS SEPERATE VARIABLES SO THEY CAN BE REARRANGED TO FIT CALENDAR FORMAT $dates[] = "\"" . $date_b . "/" . $date_c . "/" . $date_a . "\","; // RE FORMAT DATE TO FIT CALENDAR JQUERY FORMAT } if jquery needs it in json after the loop and if you have php > 5.2 $dates=json_encode($dates); if it's < 5.2 then I'd suggest using pear JSON class to encode in your javascript var natDays=<?php echo $dates; ?> // no need for the brackets json takes care of this
-
array() is more convenient if you're adding lots of values to an array $array=array('blah'=>'output','wha?'=>'input','whatever'=>'aux','etc'=>'somethingwitty'); that's the only difference, there's no real performance hit either way
-
Beginner - multiple submit button with one form
taquitosensei replied to dub_beat's topic in PHP Coding Help
instead of a delete button you could do a link with the id and an image. echo "<td align='left'>".$row[0]."</td> <td align='left'>".$row[2]."</td> <td align='left'><a href='?action=delete&id=".$row[0]."'><img src='your_delete_icon.gif' border='0'></a></td> then at the beginning of your page check for it if(isset($_GET['action']) && $_GET['action']=="delete") { // your delete function here would use $_GET['id'] } -
display 2 php codes at the top & bottom of a cell
taquitosensei replied to ilikephp's topic in PHP Coding Help
rename your file to whateverthenameis.php and the PHP is lower case <td width="212" align="left" valign="top" bgcolor="#FFFFFF"><?php include "phpFiles/top.php"; ?></td> that should do it -
do you want the output of the php saved as a text file or the actual php code? If you want the php code saved and you need your post variables. You'd have to serialize post. Then unserialize it in your code. If you just need to output. Then assign the output to a variable and write that to a text file.
-
php can only do file browsing on the computer it's running on. It's server side.
-
[SOLVED] Cronjob returns syntax error
taquitosensei replied to The14thGOD's topic in PHP Coding Help
try 52 * * * * "php /var/path/to/domain/httpdocs/csv_db.php" not sure if you need the quotes around the whole command or not -
learn about parenthesis it's just like doing high school algebra. to use your examples (((Variable A=1 or Variable A=2) and Variable B = Z) or (Variable C=M or Variable C= N))
-
[SOLVED] Timestamps for subscription newsletter
taquitosensei replied to Irresistable's topic in PHP Coding Help
unless you need to do a date/time that's not right now. In which case you would use datetime for your field then format the php accordingly. $date="1976-10-30"; $mysql_formatted_date=date("Y-m-d H:i:s", strtotime($date)); -
what you're trying to do can't be done without javascript. You would need to use javascript to submit the form onChange then check for $_POST and do whatever you need to do. require("confwifi.php"); $extract = mysql_query ("SELECT * FROM site"); $numrows = mysql_num_rows ($extract); echo"Select CAMPUS: <select name='site' onChange='this.form.submit();'>"; while ($row = mysql_fetch_assoc($extract)) { $id = $row['id']; $site = $row['site']; $ip = $row['ip']; echo"<option name='$ip'>$site</option> "; } echo "</select>"; echo ($_POST['site'])?$_POST['site']:""; ?>