-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
at a guess try require_once(CWD . 'includes/init.php'); can you tell us where the init.php file is compared to the file your editing ie home/test.php <--this file home/includes/init.php <--their
-
How to update form input field background colour on validation error
MadTechie replied to AdRock's topic in PHP Coding Help
this is a CSS question really echo( "<span style=\"font-weight: bold; color:red; background-color:#00FFFF;"\">".$errmsg."</span>" . $form ); note the background-color:#00FFFF; -
[SOLVED] A quick way to do this... loop $_POST
MadTechie replied to Perad's topic in PHP Coding Help
what about this foreach($_POST as $K => $V) { //may want to clean $K as well $Clean[$K] = $this->cleanString($V); } $fields = implode(",",array_keys($Clean)); $Values = implode("','",$Clean); $sql = "INSERT INTO dbname ($fields) VALUES ('$Values')"; -
[SOLVED] JS - Posted here coz not many post in the JS forum
MadTechie replied to plutomed's topic in PHP Coding Help
Sighs.. OK fine.. in IE.. the title can NOT have a Space, remove that from the link your be fine -
[SOLVED] JS - Posted here coz not many post in the JS forum
MadTechie replied to plutomed's topic in PHP Coding Help
if you post JS in the PHP section to get a reply everyone will start and it will be chaos... personally i'll only tell you its the wrong section.. the JS section isn't as busy but theirs posts/replies every day.. tested and a popup appeared -
[SOLVED] Most important PHP functions to learn in 3 hours
MadTechie replied to richardw's topic in Miscellaneous
-
How i store data to mysql with actual text format?
MadTechie replied to gaja's topic in PHP Coding Help
i think this is what your looking for.. unicode -
How To Display An Image From A MySQL Table
MadTechie replied to JustinK101's topic in PHP Coding Help
that will display an image without a refresh.. the script itself will not run the sql query but the makeImage.php will and as that will be used to display the image, in a word every image will run a sql query, thats how your makeImage.php has been designed -
Are there specific functions that are used for playing audio ?
MadTechie replied to jd2007's topic in PHP Coding Help
PHP IS SERVER BASED.. it runs on the server NOT the client this means that it knows very little about the client other than the connect, the client apps control what played etc -
How To Display An Image From A MySQL Table
MadTechie replied to JustinK101's topic in PHP Coding Help
OK, after re-reading a few posts.. your using AJAX to pull the image.. first off the ajax call shouldn't pull the image but a html string to display the image, So ignore the last post.. but as for <input type="button" name="clickMe" value="Click Me" onclick="requestImage(6);" /> what would you expect that to do ? Request Image(6) to do what ? heres what i think your after! <script language="javascript"> function showimage(ID) { document.getElementById('imgTest').src = "includes/makeImage.php?id="+ID; } </script> <img id="imgTest" src="" /> <input type="button" name="clickMe" value="Click Me" onclick="showimage(6);" /> -
I assume your getting data to display on the page.. if so.. this should do it replace $file_content = file_get_contents($allfiles[$currentFile]); with <?php $getfile = $allfiles[$currentFile]; preg_match_all('/\.(.{0,3})/i', $getfile, $result, PREG_PATTERN_ORDER); $result = $result[1]; $result = $result[count($result)-1]; $fileext = strtolower($result); $file_content = ""; switch($fileext) { default: case "html": case "htm": case "txt": $file_content = file_get_contents($getfile); break; case "jpg": case "jpeg": case "gif": case "png": $file_content = "<img src=\"$getfile \" />"; break; } //echo $file_content; ?>
-
How To Display An Image From A MySQL Table
MadTechie replied to JustinK101's topic in PHP Coding Help
use imagejpeg($imgdata, $filename); -
[SOLVED] need alternative to oci_fetch_array for PHP 4
MadTechie replied to rbragg's topic in PHP Coding Help
what about this <?php $queryHall = " SELECT hall FROM user.hall "; $hallResults = ociparse($connect, $queryHall); ociexecute($hallResults); echo "<select name='hallDrop'>"; echo "<option value=' '> </option>"; while( $hall = ocifetch($hallResults) ) { $hall = ociresult($hallResults, "HALL"); //added echo " \n\t<option value = '" . $hall . "'"; if (isset($_SESSION['hallDrop']) && $_SESSION['hallDrop'] == $hallList) { echo " selected='selected' "; } echo ">" . $hall . "</option>"; } echo "</select>"; ?> -
[SOLVED] need alternative to oci_fetch_array for PHP 4
MadTechie replied to rbragg's topic in PHP Coding Help
try this (lots of commenting out) whats displayed <?php $queryHall = " SELECT hall FROM user.hall "; $hallResults = ociparse($connect, $queryHall); ociexecute($hallResults); //echo "<select name='hallDrop'>"; //echo "<option value=' '> </option>"; while( $hall = ocifetch($hallResults) ) { print_r($hall); //echo " \n\t<option value = '" . $hall . "'"; //if (isset($_SESSION['hallDrop']) && $_SESSION['hallDrop'] == $hallList) //{ // echo " selected='selected' "; //} //echo ">" . $hall . "</option>"; } echo "</select>"; ?> -
OK, this isn't a request, but many have asked for this sort of thing so i thought i'll write one please read the comments if their is anything thats doesn't make sense please let me know and i'll try to explain better.. this all works as one file.. first off, this snipplet of code was written to emulate a database $NewData = ""; $P = (int)$_GET['Param']; //Emulate the database $DB[1][] = "NewItem1 - 1"; $DB[1][] = "NewItem1 - 2"; $DB[2][] = "NewItem2 - 1"; $DB[2][] = "NewItem2 - 2"; //Emulate the select $row = $DB[$P]; //use contents from DB to build the Options foreach($row as $K1 => $V1) { $NewData .= "<option value='$K1'>$V1</option>\n"; } you can replace that with $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("first_test",$dbh) if (!mysql_query("SELECT * FROM table WHERE ID=$P")) { echo "Database is down"; } while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $NewData .= "<option value='".$row['ID']."'>".$row['Name']."</option>\n"; } mysql_close($dbh); TRY this by itself first.. (single file) <?php //for use with my FIRST list box $list1[1] = "Item1"; $list1[2] = "Item2"; if( isset($_GET['Param']) ) { $NewData = ""; $P = (int)$_GET['Param']; //Emulate the database $DB[1][] = "NewItem1 - 1"; $DB[1][] = "NewItem1 - 2"; $DB[2][] = "NewItem2 - 1"; $DB[2][] = "NewItem2 - 2"; //Emulate the select $row = $DB[$P]; //use contents from DB to build the Options foreach($row as $K1 => $V1) { $NewData .= "<option value='$K1'>$V1</option>\n"; } echo $NewData; //Send Data back exit; //we're finished so exit.. } ?> <!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=iso-8859-1" /> <title>Simple Dymanic Drop Down</title> <script language="javascript"> function ajaxFunction(ID, Param) { //link to the PHP file your getting the data from //var loaderphp = "register.php"; //i have link to this file var loaderphp = "<?php echo $_SERVER['PHP_SELF'] ?>"; //we don't need to change anymore of this script var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); }catch(e){ // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){ alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { document.getElementById(ID).innerHTML = xmlHttp.responseText; } } xmlHttp.open("GET", loaderphp+"?Param="+Param,true); xmlHttp.send(null); } </script> </head> <body> <!-- OK a basic form--> <form method="post" enctype="multipart/form-data" name="myForm" target="_self"> <table border="0"> <tr> <td> <!-- OK here we call the ajaxFuntion LBox2 refers to where the returned date will go and the this.value will be the value of the select option --> <select name="list1" onchange="ajaxFunction('LBox2', this.value);"> <option value=''></option> <?php foreach($list1 as $K1 => $V1) { echo "<option value='$K1'>$V1</option>"; } ?> </select> </td> <td> <select name="list2" id="LBox2"> <!-- OK the ID of this list box is LBox2 as refered to above --> </select> </td> </tr> </table> <input type="submit" name="Submit" value="Submit" /> </form> </body> </html>
-
can you please click solved (bottom left)
-
EDIT: oops updated add 1 lines if($HTTP_POST_FILES['AttachPrint']['tmp_name']==""){ echo "No file attached"; //add (between the {} }else if(!is_uploaded_file($HTTP_POST_FILES['AttachPrint']['tmp_name'])){ $error.="<li>The file, ".$HTTP_POST_FILES['AttachPrint']['name'].", was not uploaded!"; $errors=1; }
-
when you submit the form on the search.php does the action goto upload.php ? if so then on the upload.php just use echo $_POST['name']; or echo $_GET['name']; //name being the form element name
-
change Password: <input type="password" name="text" size="20" /><br /> to Password: <input type="password" name="password" size="20" /><br /> EDIT: side note the header ('location: welcom.php'); // will fail as you have already sent data before // basic html formatting stuff print '<div id="leftcontent"> <h1>Login Form</h1> <p>Users who are logged in can take advantage of certain features like this, that, and the other thing.</p>';
-
[SOLVED] need alternative to oci_fetch_array for PHP 4
MadTechie replied to rbragg's topic in PHP Coding Help
can you do a print_r($hall); just above echo " \n\t<option value = '" . $hall['HALL'] . "'"; and post the results -
[SOLVED] need alternative to oci_fetch_array for PHP 4
MadTechie replied to rbragg's topic in PHP Coding Help
oops i mean should't $hall be $hall['hall'] ? as $hall would be the recordset and the field inside that set would be hall -
try this <script> var numa=0; var maxa=100; var atkn=new Array(maxa); <?php $all_members = mysql_query("SELECT outwarname FROM hitlist ORDER BY id ASC") or die(mysql_error()); $members = array(); while($row = mysql_fetch_assoc($all_members)) { $members[] = $row['outwarname']; } $allMembers = '"'.implode('","',$members).'"'; ?> var atkn=new Array(<?php echo $allMembers; ?>); var alvl=new Array(maxa); var alvl=new Array(); function umsg() { document.getElementById("amessage").innerHTML = "Currently: " + eval(numa+1) + " / " + maxa; document.getElementById("aname").innerHTML = atkn[numa]; } function opena() { iframe.location.href = 'http://zimbob.outwar.com/attack.php?attackname=' + atkn[numa]; numa=eval(numa+1); if (numa>=maxa) { numa="0"; } umsg(); } function backa() { numa=eval(numa-1); if (numa<0) { numa=eval(maxa-1); } umsg(); } </script> <script language="JavaScript"> var SetFocus=window.setInterval('Focus()',1000); function Focus() { window.focus(); document.Text1.select(); } document.onkeyup = function(event) { if (!event && window.event) event = window.event; if (String.fromCharCode(event.keyCode).toLowerCase() == 'n') { opena(); } } </script>
-
well the following code is fine.. you sure your not including it or something? <?php // Start the session session_start(); // Process actions $cart = $_SESSION['cart']; $action = $_GET['action']; switch ($action) { case 'add': if ($cart) { $cart .= ','.$_GET['id']; } else { $cart = $_GET['id']; } break; case 'delete': if ($cart) { $items = explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($_GET['id'] != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } $cart = $newcart; } break; } $_SESSION['cart'] = $cart; ?>