Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. If I understand correctly, your form is inside of an iframe...and you want to break out of the iframe when the form is submitted. If that's correct, you could add the "target" attribute to your <form> tag and set it to "_top".
  2. Are you building a solution where multiple people need to be logged into the same computer at the same time? If not, you can test the "multi-login" code with different browsers. User 1, for example, could be logged into Chrome. And User 2 could be logged into Firefox. Or you could use two different computers.
  3. Have you looked into using CSS positioning? More information can be found here: https://developer.mozilla.org/en-US/docs/Web/CSS/position
  4. You could use the array format when naming the form fields. Here is a quick example: <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { foreach($_POST['product'] as $currKey=>$currValue) { echo '<div>' . $_POST['product'][$currKey] . ' = ' . $_POST['price'][$currKey] . '</div>'; } } ?> <form method="post"> <?php for($i=1; $i<=5; $i++) { ?> <div> <label>Product <?php echo $i; ?> <input type="text" name="product[]" /></label> <label>Price <?php echo $i; ?> <input type="text" name="price[]" /></label> </div> <?php } ?> <input type="submit" /> </form>
  5. For what it's worth, more information about the From address can be found under the "additional_headers" parameter description here: http://php.net/manual/en/function.mail.php
  6. @FUNKAM35 - Does your page have multiple forms? If not, your $_POST variable should be "first" and not "first1"...unless there is more to your form that's not being shown. To avoid errors being shown before a form is submitted, you could check if the form was submitted before using $_POST. However, you would still need to set variables like $first so that errors don't come up while the form is being displayed. Here's a quick example: <?php //IF FORM WAS SUBMITTED if($_SERVER['REQUEST_METHOD'] == 'POST') { $first = $_POST['first']; //get the rest of the form information //ELSE...INITIALIZE FIELDS } else { $first = ''; //initialize other variables... } //dispaly form... ?>
  7. You could try something like this: <?php $sql = "SELECT * FROM music"; $q=$con->query($sql); while ($row = $q->fetch_array()){ $id = $row['id']; $name = $row['name']; $type = $row['type']; $fileLoc = $row['data']; $desc = $row['description']; $file = $row['file']; $cre = $row['created']; ?> <audio controls="controls"> <source src="<?php echo $fileLoc; ?>" type="audio/wav"> </audio> <?php } ?> Of course, you would need to modify the type attribute to match whatever your audio files are formatted as. More information about the syntax for the <audio> tag can be found here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio Also, as you loop through the files, you probably need to test whether you have an audio or video file and display the corresponding tag. I imagine you could use the if/else construct for that and the $type variable.
  8. What does listen.php do? Does it play the file...or does it download the file to the user's computer? Also, could you provide a little more information about what you mean by "play them directly"? Since you are using a loop, I assume that there are multiple files in the database. So you probably don't want the files to automatically play once they are loaded. Are you looking to load the files into a player?
  9. Are you getting any errors? Have you been able to get an audio or video file to play before? In other words, do you know if the listen.php script works? If so, did you look at your browser's source code for the page to make sure the <a> tags are being created properly?
  10. Yay, sorry I didn't notice that you posted the echo statement already. Did you see response #10?
  11. Sorry, I just noticed that you provided the echo statement already. Try changing this echo 'locations = '.$locations[0]['location_id']; To this: echo 'locations = '.$locations[0]['locID'];
  12. Could you show the code where you attempt to echo out the column information? Note that you can quickly see what an array contains using the following line of code: echo '<pre>' . print_r($locs, true) . '</pre>';
  13. Also, do you know if the query is returning any results? I'm not familiar with functions like db_query(), but I would imagine that you could try displaying the result from db_num_rows($res) to find out how many rows were returned. Another thing you could check is if SQL is flagging any errors. You could probably use db_error() for that...
  14. Is PHP set to show all errors and warnings? Note that you can add the following lines to the top of your script during the debugging process: error_reporting(E_ALL); ini_set('display_errors', 1);
  15. Once you know the array is working, you can use foreach to loop through the array. Note that the following page has an example that uses a foreach loop with a multidimensional associative array: http://php.net/manual/en/control-structures.foreach.php The example is in the 5th white box and starts with the following comment: /* foreach example 3: key and value */
  16. You should be able to access the information using $locs[0]['locID'] Quick question, is $locs just an empty array? If so, you probably don't need $int. You should be able to change this array_push($locs[$int], $columns); To this $locs[] = $columns;
  17. Are you able to use CSS? If so, you could try using border. <hr style="border-bottom:10px solid #999;" /> Note that the <hr> tag might not be necessary. You could use it on other tags like the <p> tag.
  18. There have been times where the original poster (OP) has answered their own question. In these cases, the OP should be able to mark their own post as being the best answer. Of course, there are times where the OP will click the "Mark Solved" button on their post when it really should be someone else's post being marked as the best answer. I would imagine that in most cases the OP doesn't consider their post to be the best answer. They probably just want to indicate the topic is solved and click the first button they see. In these cases, you (as a Guru) could consider changing which post is marked as the "best answer".
  19. cyberRobot

    Body of page

    @NetKongen - Are you referring to the <body> tag? If so, whatever you set the background to will dictate what the overall website will look like in the browser window. So if the <body> tag is set to a white background, the entire page will be white. Note that most browsers default the <body> background color to white...which is probably why Ch0cu3r chose to use green. The content that you put inside of the <body> tag will then be layered over top of whatever color or background that you used for the <body> tag. Note that all those <div> tags shown in Ch0cu3r's example would be added inside of the <body> tag.
  20. For what it's worth, the WHERE clause doesn't work with INSERT. More information on the syntax for INSERT can be found here: http://dev.mysql.com/doc/refman/5.6/en/insert.html
  21. No problem, glad to help! Note that I clicked the "Mark Solved" button next to mac_gyver post since that one answered your initial question.
  22. The mysqli_query() function returns false on failure. Otherwise it returns true (for update queries). More information can be found here: http://php.net/manual/en/mysqli.query.php
  23. Sorry, my brain has finally caught up. Update queries don't return a result set. So fetch_array isn't going to work. If you're looking to see how many rows were affected, you could use the function defined here: http://php.net/manual/en/mysqli.affected-rows.php Or you could just test that the query successfully executed.
  24. Did you try using mysqli_error() to see if MySQL is reporting any errors? More information about the function can be found here: http://php.net/manual/en/mysqli.error.php
×
×
  • 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.