Jump to content

Ch0cu3r

Staff Alumni
  • Posts

    3,404
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ch0cu3r

  1. Use nl2br <td><?php echo nl2br($userList[$i]["job_description"]); ?></td>
  2. To not use separate variables. You should be using arrays You would start by naming your <select> fields as color[] <select name="color[]"> ... color options ... </select> This will mean when you submit the form $_POST['color'] will be an array containing all four selected values from the select fields To loop over the values you simple use a foreach loop echo "Your chosen colors are: "; foreach($_POST['color'] as $color) { echo "$color<br />"; }
  3. Neither do we. However this usually means you query is failing. To know why the query is failing you need to add error checking to your query $shema = $mysqli->query('SHOW CREATE TABLE '.$table) ; // if the query returned FALSE - meaning there is an error if(!$shema) { // then get the error from mysql trigger_error('MySQL Error: ' $mysqli->error); } else { // query has executed without error // continue to process query result(s) }
  4. If you are writing csv data then use fputcsv. Minimum arguments this function takes is two. The first argument takes a (file) resource handler , not a filename. You get a file resouce using fopen. You will want to set fopen's mode to a (which will write contents to and append to the end to the file) // open the file named myfile.csv in append mode $handler = fopen('myfile.csv'. 'a'); The second argument is an array of values. You will want to get the values from your form and add each value to an array The other (optional) arguments allows you to specify the following (you should not need to modify these) delimiter - the character which seperates each value enclosure - the character which delimits the start and end of each value escape character - the character to use for escaping special values in csv.
  5. curl_error(); should of been curl_error($curl_init); also move curl_close($curl_init);so it comes after the else statement.
  6. Sorry left a ; (semi-colon) off the end of the following line echo "Recaptha Result: "; // <-- missing semi-colon
  7. This line here is setting the avatar to the default avatar image, if $row['avatar'] is set to the string literal default $row['avatar'] = $row['avatar'] == "default" ? site_url. "/style/images/avatar.png":site_url.$row['avatar']; You will need to change that line to something like this if($row['avatar'] == "default") { $row['avatar'] = site_url. "/style/images/noavatar-".$yourGenderVariableHere.".png"; } else { $row['avatar'] = site_url.$row['avatar']; } Replace $yourGenderVariableHere with your variable that contains the users gender.
  8. Weird you are getting a NULL result. Change the code to <?php if ( $_SERVER['REQUEST_METHOD'] === 'POST' ) { if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])) { $captchaurl = "https://www.google.com/recaptcha/api/siteverify"; // values for verifying recaptha $captcha_params = array( 'secret' => 'secret-key-here', 'response' => $_POST['g-recaptcha-response'], 'ip' => $_SERVER['REMOTE_ADDR'] ); $curl_init = curl_init(); curl_setopt($curl_init, CURLOPT_URL, $captchaurl); curl_setopt($curl_init, CURLOPT_RETURNTRANSFER, 1); // send recapture values via POST curl_setopt($curl_init, CURLOPT_POST, count($captcha_params)); curl_setopt($curl_init, CURLOPT_POSTFIELDS, $captcha_params); curl_setopt($curl_init, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($curl_init); curl_close($curl_init); echo "Curl Response: "; var_dump($response); if($response == FALSE) { echo "<p>Curl Error: " . curl_error(); } else { $result = json_decode($response, true); echo "Recaptha Result: " var_dump($result['success']); } } } Whats is the output now?
  9. Your post is not very clear. Are you saying you are wanting to create a dropdown menu, containing the options A to D, for the "Add it" column in your HTML table? Then to be able to update your database with the selected values from the dropdown menus?
  10. Agreed. Topic Locked please refer to to your other topic.
  11. No. Not like that. To pass more than one value in the querystring you separate each key/value pair with an ampersand, eg filename.php?id=value2&id2=value2&id3=value3
  12. There is no method="post" for an anchor tag (<a></a>). href="<?php productDetails.php?productId" ?> needs to be (assuming your product id column is named Id) href="productDetails.php?productId=<?php echo $donnees['Id'] ?>"
  13. What is the output of (use it after json_decode) var_dump($results);
  14. If are ticking the recaptcha then it should be working. In the code I linked to you are replacing 'secret-key-here' with your sites actual secret key right?
  15. What is the output of the following in contact.php var_dump($_POST);
  16. That code will not work. Google will only accept the secret key and the g-recaptcha-response value from a POST request. file_get_contents only does a GET request To send the values via POST you need to use curl. Take a look at this this post for example code.
  17. I maybe mistaken but isn't mysqlnd the default mysql driver as of PHP5.3?
  18. The code labeled "ORIGINAL PHP SCRIPT" is only for fetching the an image by id from the database where a row matches the id in the url and displays that image. The code labeled "SOLUTION" is for getting the last image image from the database (which will be the newest image). Are you want to display two images at the same time, the requested id image and the newest image together?
  19. value='k' should of been value='$k'
  20. Look in your browsers console tab. Any javascript errors reported?
  21. In both create and delete javascript files you will need to change $('.g-recaptcha-response').val() to be $(form).find('.g-recaptcha-response').val();
  22. The Google reCapture api requires you submit the secret key and recaptha response values via POST. Change your code to be <?php function json_status($status) { echo json_encode(array('status' => $status)); } if ( $_SERVER['REQUEST_METHOD'] === 'POST' ) { if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])) { $captchaurl = "https://www.google.com/recaptcha/api/siteverify"; // values for verifying recaptha $captcha_params = array( 'secret' => 'secret-key-here', 'response' => $_POST['g-recaptcha-response'], 'ip' => $_SERVER['REMOTE_ADDR'] ); $curl_init = curl_init(); curl_setopt($curl_init, CURLOPT_URL, $captchaurl); curl_setopt($curl_init, CURLOPT_RETURNTRANSFER, 1); // send recapture values via POST curl_setopt($curl_init, CURLOPT_POST, count($captcha_params)); curl_setopt($curl_init, CURLOPT_POSTFIELDS, $captcha_params); curl_setopt($curl_init, CURLOPT_SSL_VERIFYPEER, false); $results = curl_exec($curl_init); curl_close($curl_init); $results = json_decode($results, true); if($results['success']) { json_status('success'); } else { json_status('Invalid reCAPTCHA code'); } } else { json_status('Please re-enter your reCAPTCHA.'); } }
  23. I'm not sure whats going on then form.serialize() works for me. I guess you have to add the recapture value manually, change the ajax data: option to be data: (function() { formValues = form.serializeArray(); // add google recapture value to serlized form field values formValues.push({name: 'g-recaptcha-response', value: $('#g-recaptcha-response').val()}); return formValues; })(),
  24. The reCapture is being displayed on your page right? If you can see it, then it should be embedding a textarea into the form, named as g-recaptcha-response . form.serialize(); should be containing all the field values from your form. What happens if your change console.log(form.serialize()); to be console.log($('#g-recaptcha-response').val()); Do you get a value when submitting the form?
×
×
  • 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.