PHP - Moved: Change Variable According To Onmouseover Event
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=342929.0 Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=350095.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=330163.0 I am trying to allow the user to update a variable he chooses by radio buttons, which they will then input text into a box, and submit, to change some attributes. I really need some help here. It works just fine until I add the second layer of variables on top of it, and I can't find the answer to this question anywhere. <?PHP require('connect.php'); ?> <form action ='' method='post'> <select name="id"> <?php $extract = mysql_query("SELECT * FROM cars"); while($row=mysql_fetch_assoc($extract)){ $id = $row['id']; $make= $row['make']; $model= $row['model']; $year= $row['year']; $color= $row['color']; echo "<option value=$id>$color $year $make $model</option> ";}?> </select> Which attribute would you like to change?<br /> <input type="radio" name="getchanged" value="make"/>Make<br /> <input type="radio" name="getchanged" value="model"/>Model<br /> <input type="radio" name="getchanged" value="year" />Year<br /> <input type="radio" name="getchanged" value="color" />Color<br /><br /> <br /><input type='text' value='' name='tochange'> <input type='submit' value='Change' name='submit'> </form> //This is where I need help... <?PHP if(isset($_POST['submit'])&&($_POST['tochange'])){ mysql_query(" UPDATE cars SET '$_POST[getchanged]'='$_POST[tochange]' where id = '$_POST[id]' ");}?> This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=348839.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=346338.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=321426.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=352282.0 Okay, so, I have a script that allows a forum inside of a room in a game. If you want a forum, you mark Yes from a dropdown menu inside the editing portion of the room. It will then save that room's title into a field called `board` in the database. However, when you mark No from the dropdown, it still leaves it in there. I don't want this. I want it to change to NULL. How do I go about doing this? Here's my current coding: if (!islevel($p,$co)) newlevel($p,$co); setlevel($p,$co,"title",filter(stripslashes($title))); setlevel($p,$co,"board",filter(stripslashes($title))); } Explanations: setlevel just connects to the database and inserts these values. $title is obviously the title of the room $co = coordinates for the room Here is the editing page, where the dropdown menu is: <table width=100% style=text-align:center><tr> <td>BOARD:<br /> <select name=b> <option value=0>No</option> <option value=1 <? if ($b == 1) echo "selected" ?>>Yes</option></select><br />Was <?=$b?> </tr></table> I have a method that is returning a funny variable, it should be returning what is below and when I echo the return from inside the method it is right. Code: [Select] Software/Section but when I goto echo the from outside the class I get the following. It adds a back slash Code: [Select] Software//Section this is the method code and it works fine when I echo the returnValue the value is right Code: [Select] // Creates a dymamic case statement for making a the choice // inside and array foreach (scandir($dir) as $folderItem) { if ($folderItem != "." AND $folderItem != "..") { if (is_dir($dir.$folderItem.DIRECTORY_SEPARATOR)) { $folderItem = $folderItem ; // this allows the the dir to be placed if statements below $folderContents = $this->showPage( $dir.$folderItem ,$getPageGlobal , $subdir); $subdir = ""; // this resets so that ithe value does not get added to main links; } else { // put into if into array if($getPageGlobal== $folderItem) { $pageReturn = $dir . $folderItem; } } } } echo $pageReturn.'<br>'; return $pageReturn; This is the way I am echoing the class. This is when it decides to add the back slash Code: [Select] echo $dynamicMenu->getShowPage(); I am using a htmltable() function in FPDF and while in a MySQL While() loop I need to change the variable name each time it loops through. So basically $html needs to be $html1 on the next loop, $html2 on the next, and so on. Its probably simple, but its late and I'm tired, I can't seem to figure this one out. Here is my unfinished attempt: $htmlnum = 0; $endo = mysql_query("SELECT * FROM endorse WHERE endonum = '$endonum' AND agency = '$agency' ORDER BY ID DESC LIMIT 1"); while($endofetch = mysql_fetch_array($endo)){ $endotype = $endofetch['type']; $htmlnum = $htmlnum++; $p->htmltable($html); } below is the script.i use it for to edit a single .html file. but now i want to edit multiple .html file by this script. so i think i have to change dynimacaly (may be a dropdown form) this line $url = "p".$page.".html"; and this line. can any body help? Code: [Select] <?php function br2nl($str) { return preg_replace('=<br */?>=i', "", $str); } $action=$_POST['action']; $textarea=$_POST['textarea']; if($_GET['p']){ $page=$_GET['p']; } // Assume your text pages are called, p1.db or p2.db, etc. $url = "p".$page.".html"; if (file_exists($url)) { // do nothing } else { $url = "p0.html"; } // where to go back to after the edit ... $return="edit.php?p=$edit"; // Get page $data = implode("", file($url)); if($action=="save"){ $newtext=stripslashes($textarea); $newtext = str_replace("<?", "", $newtext); $newtext = str_replace("?>", "", $newtext); $newtext = nl2br($newtext); //echo "page: $url<br><br>\n"; //echo $newtext; $fh = fopen($url, 'w') or die("can't open file"); fwrite($fh, $newtext); fclose($fh); header ("location:edit.php?p=$page"); } else{ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>abeer cms</title> <script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ // General options mode : "textareas", theme : "advanced", plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager", // Theme options theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, // Example content CSS (should be your site CSS) content_css : "css/example.css", // Drop lists for link/image/media/template dialogs template_external_list_url : "js/template_list.js", external_link_list_url : "js/link_list.js", external_image_list_url : "js/image_list.js", media_external_list_url : "js/media_list.js", // Replace values for the template plugin template_replace_values : { username : "Some User", staffid : "991234" } }); </script> <style> body,html{ margin:0px auto; width:700px; text-align:center; } #content{ margin:0px auto; width:700px; } #middle h1 { color: transparent; font-family:georgia; font-size:12pt; margin:0; color: #dF9100; padding:10px 0px 15px 0px; text-align:left; } </style> </head> <body> <div id='content'> <? $ta=br2nl($data); echo" <a href='$return'><-- Return to Page</a><br /><br /> Make Changes and click \"Save Changes\" at the very bottom ...<br /> <form action='edit.php' method='post'> <input type='hidden' name='action' value='save'> <input type='hidden' name='p' value='$page'> <input type='hidden' name='n' value='$n'> <textarea name='textarea' rows='25' cols='80'>$ta</textarea> <br /> <input type='submit' name='submit' value='Save Changes'> </form> <div id='middle' style='width:680px; text-align:left; padding-left:20px; border:1px solid #ccc;'> </div> </div> </body> </html> "; } ?> Hi, this is a bit of a PHP and a JQuery question, so I wasn't sure which forum to post it in, but here it is... I need a way to asynchronously change a jQuery variable with PHP when a condition becomes true, without user action. I have the following JQuery: Code: [Select] <script src="http://code.jquery.com/jquery-latest.js"></script> <script> finished = false; $(document).ready(function() { setTimeout("Refresh()", 5000); }); if (!finished) { function Refresh() { location.reload(); }; } </script> Then I have the following PHP code accessing the MySQL database every time the page refreshes... Here's that code: Code: [Select] <? $query = "SELECT * FROM TempAwaitingClients WHERE PSOID = '{$_SESSION['user_id']}'"; $result = mysql_query($query); $rowCounter = mysql_num_rows($result); if ($rowCounter > 0) { while ($row = mysql_fetch_assoc($result)) { // Condition is true, need to stop the page refreshes echo '<iframe id="audiblealert" name="audiblealert" height="0" width="0" src="telephone-ring-4.wav"></iframe>'; echo '<a href="" target="audiblealert">Mute Ringer</a>'; echo 'Phone Number: ' . $row['ClientPhoneNumber'] . '<br /> Purchased Time: ' . $row['ClientPurchasedMinutes'] . ' minutes<br />'; } } else { echo 'No Clients Yet.'; } ?> Anyone have an suggestions or help? EDIT: I forgot to mention, it's the JQuery variable "finished" that I need to set to TRUE Hello I want to be able to change the class depending on if a variable is 1 or 0. <html> <p class="note-general"> This is the general </p> <p class="note-warning"> And this is the warning </p> </html> I want the variable $adult (that can be 1 or 0) to set if the class should be a note-general or note-warning. Thank you for support I am echoing a variable that is an array. I want to change the first part of the variable but don't know how to manipulte names inside the ['brackets'] Code: [Select] echo $row['v1_name']);?> lets say I have a value called $var = v1. How do I substitute that like this: Code: [Select] echo $row[$var.'_name']);?> I know the above doesnt work, but thats what i want it to do :-) Hi, I have looked everywhere for a way to do this and would be grateful for a pointer in the right direction. I want to change the background color of the div with the id of "loggedin", depending on the status. The status currently echos text depending on the value. Code: [Select] <div class="grid_12" id="loggedin"> <div> <ul id="loggedin"> <li><?php global $current_user; get_currentuserinfo(); echo 'Status : ' . $current_user->status . "\n";?></li> <li> <?php if ($current_user->status=="RED") echo "Red info"; ?> <?php if ($current_user->status=="GREEN") echo "Green info"; ?> <?php if ($current_user->status=="BLUE") echo "Blue info"; ?> <?php if ($current_user->status=="YELLOW") echo "Yellow info"; ?> </li> </div> </div> Thanks This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=316053.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=351591.0 |