merck_delmoro
Members-
Posts
70 -
Joined
-
Last visited
Everything posted by merck_delmoro
-
post your check value in every page and place it into the session
-
[SOLVED] Checkbox not being check on CheckAll button
merck_delmoro replied to Russia's topic in Javascript Help
I have answer that before here is the your last post that I answer that question http://www.phpfreaks.com/forums/index.php/topic,266488.0.html and by the way. again you forgot to make a JavaScript function named checkall and uncheckall -
try this code <script type="text/javascript"> document.write( "<?php if($totalRows_RsCustomer ==1) { ?>"); document.UserDetails.submit(); document.write( "<?php } ?>"); </script>
-
Use mysql_num_rows for counting the list of members inside your database example $query = mysql_query("SELECT username FROM members"); $result = mysql_num_rows($query); if($result>0) { // Do Something } else { echo "No Members Registered"; }
-
that's because you implode the $linearray it will join all the data inside the $linearrray and insert it into the database
-
try to check if your password was same on the encrypted password you entered echo your password 1st using sha1 then compare the password from the database and the output
-
have a question on your code is you password encrypt using sha1 in your database??? you only use sha1 if your password in the database was encrypt with US Secure Hash Algorithm 1.
-
use JavaScript here is the code <script type="text/javascript"> function checkall(chek) { for (i = 0; i < chek.length; i++) chek[i].checked = true; } </script> <?php require("inc/config.php"); if (isset($_POST['del'])) { for ($count = 0;$count<count($_POST[delchk]);$count++) { $delete = $_POST[delchk][$count]; $query = "DELETE FROM persons WHERE person_id = '$delete'"; $result = mysql_query($query); if (!$result) { die("Error deleting persons! Query: $query<br />Error: ".mysql_error()); } } } $result = mysql_query("SELECT * FROM persons"); echo "<form name = 'myform' action='' method='post'>"; while($row = mysql_fetch_array($result)) { echo "First Name: " . $row['FirstName'] . ""; echo "<br>"; echo "Last Name: " . $row['LastName'] . ""; echo "<br>"; echo "<a target=frame2 href='" ."profile.php?user1=". $row['FirstName'] ."'>Profile</a>"; echo "<br>"; echo "Date: " . $row['AddedDate'] . ""; echo "<br>"; echo "IP Address: " . $row['Ip'] . ""; echo "<br>"; echo '<input type="checkbox" id="delchk" name="delchk[]" value="'.$row['id'].'" />'; echo "<br>"; echo "***********************************************"; echo "<br>"; } echo "</table><input type='submit' name = 'del' value='Delete'><input type='button' onclick='checkall(document.myform.delchk);' value='CHECK ALL'></form>"; mysql_close($con); ?> [code]
-
I have change your Page 1 You miss place your form tag on your code the font, size,color was not place inside the form tag that's why they not been post on your Page 2 <html> <head> <title>CHAPTER 2, QUESTION 4</title> </head> <body> <form method = "post" action = "chap2q4endresult.php"> <p>Enter you font choice: <select name="font"> <option value="Verdana">Verdana</option> <option value="Arial">Arial</option> <option value="Times New Roman">Times New Roman</option> </select> </p> <p>Enter your font size: <select name="size"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> </p> <p>Enter your font colour: <select name="color"> <option value="black">Black</option> <option value="red">Red</option> <option value="green">Green</option> <option value="purple">Purple</option> </select> </p> <p>Enter your text here: <input type = "textarea" font ="font" size="size" name = "user"> </p> <input type="submit" name="Submit" value="Submit"> </form> </body> </html>
-
place this inside your code $query = mysql_query("SELECT * FROM Users WHERE username = $username"); $result = mysql_num_rows($query); if($result == 0) { // Insert to the database } else { //do somthing }
-
i forgot something on the code try this <?php require("inc/config.php"); if (isset($_POST['del'])) { for ($count = 0;$count<count($_POST[delchk]);$count++) { $delete = $_POST[delchk][$count]; $query = "DELETE FROM persons WHERE person_id = '$delete'"; $result = mysql_query($query); if (!$result) { die("Error deleting persons! Query: $query<br />Error: ".mysql_error()); } } } $result = mysql_query("SELECT * FROM persons"); echo "<form action='' method='post'>"; while($row = mysql_fetch_array($result)) { echo "First Name: " . $row['FirstName'] . ""; echo "<br>"; echo "Last Name: " . $row['LastName'] . ""; echo "<br>"; echo "<a target=frame2 href='" ."profile.php?user1=". $row['FirstName'] ."'>Profile</a>"; echo "<br>"; echo "Date: " . $row['AddedDate'] . ""; echo "<br>"; echo "IP Address: " . $row['Ip'] . ""; echo "<br>"; echo '<input type="checkbox" name="delchk[]" value="'.$row['id'].'" />'; echo "<br>"; echo "***********************************************"; echo "<br>"; } echo "</table><input type='submit' name = 'del' value='Delete'></form>"; mysql_close($con); ?>
-
When i submit the form, browser just prints my code
merck_delmoro replied to soundaddict's topic in PHP Coding Help
@JOWP maybe you are right about print but if there are errors in php script there should be no output and it will be blank @soundaddict check if your xamp server was activate or online -
try this <?php require("inc/config.php"); if (isset($_POST['del'])) { for ($count = 0;$count<count($_POST[delchk]);$count++) { $query = "DELETE FROM persons WHERE person_id = '$_POST[delchk][$count]'"; $result = mysql_query($query); if (!$result) { die("Error deleting persons! Query: $query<br />Error: ".mysql_error()); } } } $result = mysql_query("SELECT * FROM persons"); echo "<form action='' method='post'>"; while($row = mysql_fetch_array($result)) { echo "First Name: " . $row['FirstName'] . ""; echo "<br>"; echo "Last Name: " . $row['LastName'] . ""; echo "<br>"; echo "<a target=frame2 href='" ."profile.php?user1=". $row['FirstName'] ."'>Profile</a>"; echo "<br>"; echo "Date: " . $row['AddedDate'] . ""; echo "<br>"; echo "IP Address: " . $row['Ip'] . ""; echo "<br>"; echo '<input type="checkbox" name="delchk[]" value="'.$row['id'].'" />'; echo "<br>"; echo "***********************************************"; echo "<br>"; } echo "</table><input type='submit' name = 'del' value='Delete'></form>"; mysql_close($con); ?>
-
When i submit the form, browser just prints my code
merck_delmoro replied to soundaddict's topic in PHP Coding Help
you need a php server like wamp or xamp -
change the name of checkbox to delchk[] to make it inserted to array and from your php script do this if (is_array($_POST['delchk'])) { for ($count = 0;count<count(delchk);count++) { $query = "DELETE FROM persons WHERE person_id = '$delchk[$count]'"; $result = mysql_query($query); if (!$result) { die("Error deleting persons! Query: $query<br />Error: ".mysql_error()); } } }
-
my mistake the one that I count is the query not its records inside the query the Post DrTrans was correct
-
try this $query2 = "SELECT * FROM property WHERE Owner_ID = '$ownerid'"; $result2 = mysql_query($query2); echo "<b>Amount of Properties Owned:</b>".count($result2);
-
[SOLVED] Using a variable to insert a date
merck_delmoro replied to Evollusion's topic in PHP Coding Help
try this code: I change a little bit of your code and erase something if ($_POST){ // set initial variables $mysqli = mysqli_connect("xxxxxx", "xxxxxx", "xxxxxx", "xxxxxx"); $day=$_POST['dayNum']; $month=$_POST['monthNum']; $year=$_POST['yearNum']; $fulldate= $year."-".$month."-".$day; //set the insert query to a variable value $case_info = "INSERT INTO caseFile (caseID, caseDate, caseInternal, caseStatus, caseResolution) VALUES (null,'$fulldate', '$_POST[internal]', '$_POST[status]', '$_POST[resolution]')"; // run the query and error out if it takes a dump $add_case_res = mysqli_query($mysqli, $case_info) or die(mysqli_error($mysqli)); mysqli_close($mysqli); $display_block = "<p>Your entry has been added.</p><br />"; } -
[SOLVED] doesnt populate the database
merck_delmoro replied to bigbenbuilders's topic in PHP Coding Help
go to this link and try to study php script and learn how to connect it to your database http://www.w3schools.com/php/default.asp -
I have made a code that search multiple words from string and I have made it but there is one thing missing on my code I want the the list of search found will the sort into the nearest match string here's my code index.html <html> <head> <script type="text/javascript" src="javascript.js"></script> </head> <body> <form> First Name: <input type="text" id="txt1" onkeyup="showHint(this.value)" /> </form> <p>Suggestions: <br><span id="txtHint"></span></p> </body> </html> javascript.js var xmlhttp function showHint(str) { if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; } xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url="getmatches.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChanged() { if (xmlhttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } getmatches.php <?php $count = 0; $matches = array(); $handle = fopen("data.csv", "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); for ($c=0; $c < $num; $c++) { $a[$count][$c] = $data[$c]; $names[$count][$c] = $data[$c]; } $count++; } fclose($handle); //get the q parameter from URL $q=$_GET["q"]; $find = explode(" ",$q); //lookup all hints from array if length of q>0 if (strlen($q) > 0) { $hint=""; for($count=0;$count<count($a);$count++) { for($i=0; $i<count($a); $i++) { if (preg_match('/\b(' .implode('|', $find) .')/i', $a[$count][$i],$match)) { if ($hint=="") { $hint=$a[$count][$i]; } else { $hint=$hint."<br> ".$names[$count][$i]; } } } } } // Set output to "no suggestion" if no hint were found // or to the correct values if ($hint == "") { $response="no suggestion"; } else { $response=$hint; } //output the response echo $response; ?>
-
Question on HTML form on javascript
merck_delmoro replied to merck_delmoro's topic in Javascript Help
this is my code: <script type="text/javascript"> function addRow(table_id){ var clone; var rows=document.getElementById(table_id).getElementsByTagName('tr'); var index=rows.length; var newcopy = document.getElementById(table_id); var tbo=newcopy.getElementsByTagName('tbody')[0]; clone=rows[index-1].cloneNode(true); tbo.appendChild(clone); } function delRow(table_id,button){ var row = button.parentNode.parentNode; var tbo = document.getElementById(table_id).getElementsByTagName('tbody')[0]; tbo.removeChild(row); } </script> <form method="post" action="upload_file.php" enctype="multipart/form-data"> <table id="mytab"> <tr> <td>Upload File <input type="file" name="file[]" onchange="addRow('mytab')" /> <input name="del_row" type="button" value="Remove Row" onclick="delRow('mytab',this)"/></td> </tr> </table> <input type="submit" value="UPLOAD"> </form> this code will duplicate the <input type="file"> but it copies its content on it what should I change? -
how to erase the value of <input type="file">????
-
what is the ascii code of enter???? I want to used it to my php mailing code