Jump to content

merck_delmoro

Members
  • Posts

    70
  • Joined

  • Last visited

Everything posted by merck_delmoro

  1. post your check value in every page and place it into the session
  2. 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
  3. try this code <script type="text/javascript"> document.write( "<?php if($totalRows_RsCustomer ==1) { ?>"); document.UserDetails.submit(); document.write( "<?php } ?>"); </script>
  4. 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"; }
  5. that's because you implode the $linearray it will join all the data inside the $linearrray and insert it into the database
  6. 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
  7. 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.
  8. 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]
  9. 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>
  10. 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 }
  11. @deadlyp99 you didn't done anything that can help mr King94 you only erase space on the code but it doesn't affects the output
  12. use this code <?php echo "<font color=".$_POST['color']." size=".$_POST['size']." face = ".$_POST['font'].">".$_POST['inputtext']."</font>" ?> or try to use JavaScript
  13. 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); ?>
  14. @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
  15. 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); ?>
  16. 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()); } } }
  17. my mistake the one that I count is the query not its records inside the query the Post DrTrans was correct
  18. try this $query2 = "SELECT * FROM property WHERE Owner_ID = '$ownerid'"; $result2 = mysql_query($query2); echo "<b>Amount of Properties Owned:</b>".count($result2);
  19. 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 />"; }
  20. 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
  21. 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; ?>
  22. 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?
  23. how to erase the value of <input type="file">????
  24. what is the ascii code of enter???? I want to used it to my php mailing code
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.