Jump to content

JIXO

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by JIXO

  1. I'm not posting, and u know y !!

  2. Where are you defining dead function ? try this, it may work : <?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "xxxxx@xxxxxxx"; $email_subject = "Your email subject line"; // function died($error) { --> What is this doing here //{ // Does this field have a value? if (empty($_REQUEST[$fieldName])) { echo 'Please go back and fill out ' . $fieldName . "<br>\n"; // validation expected data exists if(empty($_POST['first_name']) || empty($_POST['last_name']) || empty($_POST['email']) || empty($_POST['telephone']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } if ((!first_name) || (!second_name)) { $errorMsg = 'Please make sure you have filled in the required fields:<br /><br />'; } // --> You forgot a closing the if statement if (!$first_name) { $errorMsg = 'Please fill in your First Name<br />'; } if (!$seond_name) { $errorMsg = 'Please fill in your Second Name<br />'; } if (!$mobile_number) { $errorMsg = 'Please fill in your contact number<br />'; } if (!$email) { $errorMsg = 'Please fill in your email address<br />'; } } //strip lashes $first_name = stripslashes($name); $second_name = stripslashes($second_name); $phone = stripslashes($phone); $email = stripslashes($email); //clean string $email_message .= "First Name: ".clean_string($first_name)."\n"; $email_message .= "Last Name: ".clean_string($last_name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Telephone: ".clean_string($telephone)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); } // --> Also forgot to close the if [ isset($_POST['email']) ]
  3. JIXO

    CSS wont display

    Just move the showDate div under the hyperlink : <HTML> <head> <link type="text/css" href="displayDate.css" /> <script type='text/javascript'> function myFunction() { var currentDate = new Date(); var dateTime = (currentDate.getMonth()+1) + "/" + currentDate.getDate() + "/" + currentDate.getFullYear(); document.write("Today's date : "); document.write(dateTime); //document.getElementById('currentDate').innerHTML = dateTime; document.cookie = dateTime; var lastVisit = document.cookie; document.write('<br />'); document.write('Last visit : '); document.write(lastVisit); } </script> </head> <body> <a href="#" onclick="document.getElementById('showDate').style.display = 'block';"> Show Date </a> <div id="showDate" style="display:none"> <script type="text/javascript"> myFunction(); </script> </div> </body> </HTML>
  4. JIXO

    CSS wont display

    Try this : div #showDate { position: absolute; top: 20px; } <HTML> <head> <link type="text/css" href="displayDate.css" /> <script type='text/javascript'> function myFunction() { var currentDate = new Date(); var dateTime = (currentDate.getMonth()+1) + "/" + currentDate.getDate() + "/" + currentDate.getFullYear(); document.write("Today's date : "); // <- Added this message for explaining what is happining document.write(dateTime); //document.getElementById('currentDate').innerHTML = dateTime; document.cookie = dateTime; var lastVisit = document.cookie; // <- You wrote Var for defining last visit, JavaScript is case sensitive document.write('<br />'); // <- Added this message for explaining what is happining document.write('Last visit : '); // <- Added this message for explaining what is happining document.write(lastVisit); // <- lastVisit was defined after it was printed, which caused the 'undefined' error message } </script> </head> <body> <div id="showDate" style="display:none"> <script type="text/javascript"> myFunction(); </script> </div> <a href="#" onclick="document.getElementById('showDate').style.display = 'block';"> Show Date </a> </body> </HTML>
  5. Here, why don't you start with this. At first, change the dropdown items to display your database tables, after that change AJAX respond to display your table. Post any errors/problems you have so we can help u.
  6. Why u r not using if condition : if(preg_match('/<div contenteditable="true"><p>/', $post)) { $newpost = $post; } else { $newpost = str_replace("<p>", "<div contenteditable=\"true\"><p>", $post); }
  7. It didn't mention removing database username too , but obviously there is no way the code is fully working without specifing a database name
  8. Hi, The username, password and database name were removed when pasted here for sure :
  9. Sometimes it’s easier to smile and pretend you’re happy instead of trying to explain why you’re not…

  10. You can also escape : echo "<li><a href='profile.php?=$_SESSION[\'id\']'>My profile</a></li>";
  11. You may be looking for preg_replace() function. <?php $formhtml = '<form action="" method="post">'; $pattern = '/action=""/'; $replacements = array(); $replacements[0] = ''; $replacements[1] = 'action="action1"'; echo preg_replace($pattern, $replacements[0], $formhtml)."<br />"; echo preg_replace($pattern, $replacements[1], $formhtml); Will output : <form method="post"> <form action="action1" method="post">
  12. Here is the HEREDOC documentation, I'm not sure of what u r trying to achive, for example : $crappychat_service will give you something like Resource #14, not usefull result to write in a file. Try using this : <?php //Make logChatInput.php $dataBase = "users"; $logChatInput = fopen($newDir."/logChatInput.php", "w"); date_default_timezone_set('America/Chicago'); $time = date('g:i A'); $chatInput = addslashes($_GET["chatInput"]); $connectionStatus = NULL; $crappychat_service = mysql_connect("localhost", "root", "123"); $connectionStatus = ($crappychat_service) ? 'Connected' : 'Failed to connect'; $dbSelectionStatus = NULL; $dbSelectionStatus = (mysql_select_db("{$dataBase}", $crappychat_service)) ? 'DB selected' : 'DB not found'; $sql = "INSERT INTO messages (Message) VALUES('".$chatInput."')"; $queryStatus = NULL; $queryStatus = (mysql_query($sql, $crappychat_service)) ? 'Query OK' : 'Query failed'; $logChatInput_contents = <<<EOD chatInput value : $chatInput MySql connection : $connectionStatus Database selection : $dbSelectionStatus SQL : $sql Query status : $queryStatus EOD; var_dump($logChatInput_contents); fwrite($logChatInput, $logChatInput_contents); fclose($logChatInput); Will output : string ' chatInput value : dslfkd MySql connection : Connected Database selection : DB not found SQL : INSERT INTO messages (Message) VALUES('dslfkd') Query status : Query failed' (length=209) I hope this sets u in the right direction
  13. Hi tycoon, give this a try : $q = html_entity_decode(urldecode($_GET['q']));
  14. It's strage to me that # character can break HTML page : In either ways, this might help you tycoonbob if this is the case while ($row = mysqli_fetch_array($result)) { echo '<option value="' . $row['name'] . '">' . $row['name'] . '</option>'; }
  15. PHP alone won't do the trick, if you need to add buttons to show answers, you need to consider AJAX with PHP. Another workaround is to add JS function(s) to reveal the answers, but if you're dealing with experinced user, a look at page source will get him/her 100% correct answers.
  16. Oh, sorry about that, I totally forgot the escaping part for SQL. Instead of using htmlenitities(), I think you should use mysqli_real_escape_string() : $sql="SELECT sku FROM products WHERE name = '".mysqli_real_escape_string($con, $q)."'"; Sorry for the late reply.
  17. Hi, you have added a div as the value of sku input element, try this for add.php : <html> <head> <link rel="stylesheet" type="text/css" href="css/styles.css" media="screen" /> <title>Add Inventory</title> <script> function showUser(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","getsku.php?q="+str,true); xmlhttp.send(); } </script> </head> <body> <?php session_start(); require_once('includes/config.inc.php'); require_once('includes/functions.inc.php'); $thisPage='add'; include('includes/navbar.inc.php'); ?> <h1>Add New Inventory Record</h1> <form method="POST" action="submitadd.php" /> <table id="add"> <tr> <td class="headings"><b>Species:</b></td> <td><select name="species:" onchange="showUser(this.value)"> <option value="select">Choose a Species</option> <?php $prodquery="SELECT name FROM products ORDER BY name ASC"; $result=mysqli_query($con,$prodquery) or die(mysqli_error($con)); while ($row = mysqli_fetch_array($result)) { echo "<option value='" . $row['name'] . "'>" . $row['name'] . "</option>"; } ?> </select> </td> </tr> </table> <div id="txtHint"><b>SKU:</b></div> <input type="submit" name="submit" value="submit" class="button1" /> </form> </body> </html> getsku.php <?php $q = html_entity_decode($_GET['q']); require_once('includes/config.inc.php'); $sql="SELECT sku FROM products WHERE name = '".$q."'"; $result = mysqli_query($con,$sql); echo "<table border='1'> <tr> <th>SKU</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td><input type='text' name='sku' value='" . $row['sku'] . "' readonly='readonly' size='35' /></td>"; echo "</tr>"; } echo "</table>"; mysqli_close($con); ?> And also you do not need to use intval(), hope this solves the problem.
  18. In getsku.php try this : $q = intval(html_entity_decode($_GET['q']));
  19. Hi, you will need AJAX to accomplish this, here is an exact example.
  20. Sorry, the above was messed up, try this : <?php $conn = new mysqli('*', '*', '*'); $conn->select_db('mynotesdatabase'); $query = mysqli_query($conn, 'SHOW TABLES') or die(mysql_error()); while($tableShow = mysqli_fetch_row($query)) { $result = mysqli_query($conn, "SELECT * FROM {$tableShow[0]}") or die(mysql_error()); echo "<b>+" . $tableShow[0] . "</b><br/>"; while($fields = mysqli_fetch_assoc($result)) { $type = ""; if($fields['Type'] == 0) { $type = "Link"; } else { $type="Note"; } echo "&nbsp -" . $fields['Name'] . " (" . $type . ")"; echo "<br>"; } } mysql_close($conn); If you get any error, paste it here.
  21. <?php $conn = new mysqli('*', '*', '*'); $conn->select_db('mynotesdatabase'); $query = mysqli_query($conn, 'SHOW TABLES') or die(mysql_error()); while($tableShow = mysqli_fetch_row($query)) { $result = mysqli_query($conn, "SELECT * FROM {$tableShow[0]}") or die(mysql_error()); echo "<b>+" . $tableShow[0] . "</b><br/>"; while($fields = mysqli_fetch_assoc($result)) { $type = ""; if($fields['Type'] == 0) { $type = "Link"; } else { $type="Note"; } echo "&nbsp -" . $fields['Name'] . " (" . $type . ")"; echo "<br>"; } } mysql_close($conn);
  22. Hi, attach your database and config.php file.
  23. You are welcome nisroc.
  24. It is possible, but you need the isset() method, your if condition will always be false if you do not assign a value to 'delivery_time' : Instead use if(isset($_GET['delivery_time']))
×
×
  • 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.