-
Posts
3,145 -
Joined
-
Last visited
-
Days Won
37
Everything posted by cyberRobot
-
Try playing around with the margin property for the <p> tags. More information can be found here: https://developer.mozilla.org/en-US/docs/Web/CSS/margin
-
The "5" in your unset() example needs to refer to a key...assuming that $list is your array. You could use a foreach loop to get the array index for the items you want to remove and then use unset(). Note that you could also consider using array_flip() to swap the array's keys and values; unset the items you want to remove; and then flip the array back. More information about array_flip() can be found here: http://php.net/manual/en/function.array-flip.php Of course, you'll want to make sure there are no duplicate values in the array before using array_flip().
-
Submit $_POST with dynamically generated fields
cyberRobot replied to bambinou1980's topic in PHP Coding Help
I would imagine that the OP was just trying to connect the product name to the corresponding price fields. Using Barand's suggestion to tie the product ID to the field names should eliminate the need for the drop-down fields. -
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".
-
Need help with user validation for my website please!
cyberRobot replied to Xines's topic in PHP Coding Help
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. -
how can i show numbers on the thumbnail of post
cyberRobot replied to silver7's topic in PHP Coding Help
Have you looked into using CSS positioning? More information can be found here: https://developer.mozilla.org/en-US/docs/Web/CSS/position -
Submit $_POST with dynamically generated fields
cyberRobot replied to bambinou1980's topic in PHP Coding Help
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> -
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
-
@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... ?>
-
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.
-
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?
-
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?
-
No problem; glad to help!
-
Yay, sorry I didn't notice that you posted the echo statement already. Did you see response #10?
-
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'];
-
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>';
-
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...
-
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);
-
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 */
-
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;
-
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.
-
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".
-
@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.
-
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
-
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.