Jump to content

JIXO

Members
  • Posts

    60
  • Joined

  • Last visited

JIXO's Achievements

Newbie

Newbie (1/5)

2

Reputation

  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.
×
×
  • 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.