Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/29/2019 in all areas

  1. Your post lacks relevant information what should this mean to anyone? What error messages did you get? What is the actual and the expected behavior? Your code is incomplete, you did not say which return values you got or what you tested against.
    1 point
  2. There are a few issues here: echo'<form method="POST" action"'.getLocations($conn).'"> 1. getLocations() is a function that does not return anything. You can't use it with a string like that. 2. The form action is supposed to be a URL. If you want to submit the form to the same page it's on you can leave the action empty or missing. 3. There needs to be an equals sign with that action. <!--foreach($zip as $zip) : --> 4. That's PHP code. If you need to comment it out, keep it inside the <?php tags and use a PHP comment, not an HTML comment. 5. $zip that was set inside the getLocations() function is not going to be available to use outside the function. You should make the function return the value, then when you call it assign the returned value to a variable. 6. The function is only set to do anything when the form is submitted. Make sure that everything still works even when the form hasn't been submitted yet. 7. Don't iterate over a variable and then use that same variable name for the individual values. You'll confuse yourself. Perhaps use $zips and $zip? echo $address['address']; 8. $address is never defined anywhere. Did you mean $zip? But... echo $zip['zip']; 9. Since you commented out the foreach loop, and because of #5, there is no $zip to use. if (isset($_POST['submit'])){ 10. Your form's submit button is not named "submit". function getLocations($conn) { 11. This function requires that you pass it an argument for the database connection (which you have also named $conn). You aren't doing that.
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • 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.