etsted
-
Posts
274 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by etsted
-
-
that has nothing to with that case, ofcourse the $file_url is above my video tag! Besides, do i need to specify the type attribute when i use video tag og audio tag?
-
it doesnt work, when i specify the type attribute? why?
do i even need it?
it looks something like this:
<video width="320" height="240" controls> <source src="<?php echo $file_url;?>" type="video/mp4"> <source src=<?php echo $file_url;?>" > Your browser does not support the video tag. </video>
$file_url = "videos/2014042727116180637260000009088958.mp4";
-
clear both
in CSS
my bottomDiv is still not able to clear:both, whats wrong?
-
strtolower
in PHP
even professionals like me can make mistakes
-
strtolower
in PHP
$haystack = array("gif");$fileParts = array("extension" =>"GIF", nr2 => "JPG");$fileParts = $fileParts['extension'];$fileParts = strtolower($fileParts[0]);if(in_array($fileParts, $haystack)){ echo "right";} else { echo "false";}
this returns false, how can i make it return true?
in real life, the $fileParts array is acctaully $_FILES['fileName']['name'], where i try to make the extension into lower case before the array check
-
clear both
in CSS
<body><div id='topDiv'> <!-- Main Top Div --><!-- logo image/link --><div id='Logo'><a href='index.php'><img src='images/logo.png' height='90' width='120' alt='logo' border='0'></a></div><div id='inside1_topDiv'><a href='user.php?u=victor'> victor </a> | <a href='logout.php'>Log Out</a> </div><div id='inside2_topDiv'><a href='index.php'>Home</a><a href="notifications.php" title="Your notifications and friend requests"><img src="images/note_still.png" width="22" height="12" alt="Notes"></a><a href='upload.php?u=victor'>Upload</a> </div><span style='margin-left: 30%';>Hello victor, lastlogin: 2014-04-26</span> </div> <!-- Main Top Div --> <div id="middleDiv"> </div><!-- template_bottomDiv.php includes both </body> and </html> --><div id="bottomDiv">bottom text</div></body></html>
-
clear both
in CSS
<?php // this already includes a connection to the DB, and a session_start() // also check to see if a user i logged in // include_once "check_user.php"; // this stores error messages redirected from other pages $msg = ""; if(isset($_GET['msg'])) { $msg = $_GET['msg']; } ?> <!-- contains !DOCTYPE and all of the header elements --> <?php include_once "header_function.php"; echo header_function("Home page");?> <!-- template_topDiv.php also includes a <body> and </head> tag --> <?php include_once "template_topDiv.php";?> <div id="middleDiv"> <?php echo $msg;?> </div> <!-- template_bottomDiv.php includes both </body> and </html> --> <?php include_once "template_bottomDiv.php"; // this include the <div id="bottomDiv"></div>
-
is there something wrong with this code?
// make them a folder, where we store their files if(!file_exists("user/$username")) { $image = "avatardefault.png"; mkdir("/user/$username/$image"); } else { $message = "something went wrong, while trying to make you a own folder"; }
bcz at my server it doesnt allow me to make a folder to each user. WHat should i do?
-
i have here a tekst field and a button, that interacts with php using ajax
$status_ui = '<textarea id="statustext" onkeyup="statusMax(this,250)" placeholder="What's new with you '.$u.'?"></textarea>'; $status_ui .= '<button id="statusBtn" onclick="postToStatus('status_post','a',''.$u.'','statustext')">Post</button>';
But i get some sort of an error, which i dont know why is there
i get all the variables using the postToStatus function, and then send them to a php script using:
ajax.send("action="+action+"&type="+type+"&user="+user+"&data="+data);
in the php script i have an if statement
if($_POST['type'] != 'a' || $_POST['type'] != 'c')
{
echo "type_unknow";
exit;
}
it doesnt say anything about $_POST['type'], but when i run print_r i can see that the $_POST['type'] is set
-
clear both
in CSS
this is my style.css, and the ids refers to divs, but i cant make the bottomDiv clear:both. And it stacks above some of my elements
body { margin: 0px; }/* topDiv */ /* #topDiv, the main top div */ #topDiv{ height: 90px; background-color: #00ff00; margin: 0px; padding: 0px; border: 0px; } /* used to design the logo */ #topDiv > #Logo{ margin-left: 30px; float: left; width: 120px; height: 90px; } /* used inside the first div of topDiv */ #topDiv > #inside1_topDiv { height: 45px; margin-top: 20px; margin-right: 50px; float: right; } /* use this to change the links that are inside #inside1_topDiv */ #topDiv > #inside1_topDiv > a{ margin: 20px; color: #004000; } /* use this to change the hover state of links that are inside #inside1_topDiv */ #topDiv > #inside1_topDiv > a:hover{ margin: 20px; color: #ffffff; } /* used inside the second div of topDiv */ #topDiv > #inside2_topDiv { height: 45px; margin-left: 20px; border: 1px solid red; float: left; } /* use this to change the links that are inside #inside2_topDiv */ #topDiv > #inside2_topDiv > a{ margin: 20px; color: #004000; } /* use this to change the hover state of links that are inside #inside2_topDiv */ #topDiv > #inside2_topDiv > a:hover{ margin: 20px; color: #ffffff; }/* topDiv *//* middleDiv */#middleDiv{ height: 600px;}/* middleDiv *//* bottomDiv */#bottomDiv{ text-align: center; color: #00ff00; clear:both; border: 5px solid red; margin-bottom: 0px; padding: 24px;}/* bottomDiv */
-
-
validation
in PHP
i am trying to make a validation script. This script return false if i use two or more variables that are empty
$usernameErr = $pass1Err = $emailErr = $genderErr = $pass2Err = $wrong_passErr = "";
if($emailErr && $usernameErr == "") { echo "right"; } else { echo "wrong"; } // this returns false
if($usernameErr == "") { echo "right"; } else { echo "wrong"; } // this return true
if($emailErr == "") { echo "right"; } else { echo "wrong"; } // this returns true
-
inputs width
in CSS
i want to make the input field longer by using the width property, but in w3schools it says that it should only be used with type="image". If that so, how could i make a longer search bar? Do i use something else?
-
body { margin: 0px; }
it still doesnt work
-
this is my code to a div i have
background: #11ff11; padding: 24px; font-size: 12px; color: #000000; text-align: center; clear: both; margin-bottom: 0px;
but i keep seeing that there is always some white space at bottom that i cant clear away. there is about 20 pixel with white space from the bottominbetween my div.
-
this script is supposed to only register a user if he has not been on my website, but this script keep on adding the IP of a person all the time
$filref = fopen("tekst.txt", "a");$ip = $_SERVER['SERVER_ADDR'];$les_fil = fread($filref, filesize("tekst.txt"));if(!strchr($les_fil, $ip) ){ fwrite($filref, $ip);}else{ echo "cannot register more";}
-
is there any good php learning sites, where i wont just be teached how to code php, but also given task to complete. Just like codecademy.com?
-
i am trying to make a php gallery system without a database.
I want to make 2 cols with 3 rows, for each picture. And there should be a link that i can press to take me to another page, to show me other pictures, in case the first gallery becomes full.
( i am not asking someone to build it for me, i am just wondering about diffrent functions i would need).
-
hidden type
in PHP
it says Invalid argument supplied for foreach()
-
hidden type
in PHP
the function at the bottom is supposed to store both the value and name of the choosen argument, but only stores the name
<body> <form action="hovedrett.php" method="post"> <select name="frett"> <option>rekkeplatte</option> <option>friske reker</option> </select> <br> <input type="submit" name="knapp" value="Neste"> </form> <?php $forrett = $_POST['frett']; function bevare($mat) { foreach($mat as $indeks => $verdi) { if( !strstr($indeks, "knapp")) { echo "<input type='hidden' name='$verdi' value='$indeks'> "; } // if } // foreach } bevare($forrett); ?></body>
-
this code generates unexpecteT_IF
echo " <form> <select name='mnd'> <option value='jan'>jan</option> <option value='feb'>feb</option> <option value='mar'>mar</option> <option value='Apr' " . if($dagen_mnd == 'Apr'){echo "selected='selected'";} . ">Apr</option> </select> </form>";
-
ajax and php
in PHP
i have a pagination script with ajax and php, but i doesnt show anything on the page, not even erros.
ajax.pagination.php
<?phpinclude_once("connect.php");// This first query is just to get the total count of rows$sql = "SELECT COUNT(id) FROM data";$query = mysqli_query($con, $sql) or die(mysqli_error());$row = mysqli_fetch_row($query);// Here we have the total row count$total_rows = $row[0];// Specify how many results per page$rpp = 10;// This tells us the page number of our last page$last = ceil($total_rows/$rpp);// This makes sure $last cannot be less than 1if($last < 1){ $last = 1; } // Close the database connection mysqli_close($con); ?> <!DOCTYPE html> <html> <head> <script> var rpp = <?php echo $rpp; ?>; // results per page var last = <?php echo $last; ?>; // last page number function request_page(pn) { var results_box = document.getElementById("results_box"); var pagination_controls = document.getElementById("pagination_controls"); results_box.innerHTML = "loading results ..."; var hr = new XMLHttpRequest(); hr.open("POST", "pagination_parser.php", true); hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { var dataArray = hr.responseText.split("||"); var html_output = ""; for(i = 0; i < dataArray.length - 1; i++) { var itemArray = dataArray.split("|"); html_output += "ID: "+itemArray[0]+" - Testimonial from <b>"+itemArray[1]+"</b><hr>"; } results_box.innerHTML = html_output; } } hr.send("rpp="+rpp+"&last="+last+"&pn="+pn); // Change the pagination controls var paginationCtrls = ""; // Only if there is more than 1 page worth of results give the user pagination controls if(last != 1) { if (pn > 1) { paginationCtrls += '<button onclick="request_page('+(pn-1)+')"><</button>'; } paginationCtrls += ' <b>Page '+pn+' of '+last+'</b> '; if (pn != last) { paginationCtrls += '<button onclick="request_page('+(pn+1)+')">></button>'; } } pagination_controls.innerHTML = paginationCtrls; } </script> </head> <body> <div id="pagination_controls"></div> <div id="results_box"></div> <script> request_page(1); </script> </body> </html>
pagination.parser.php
<?php// Make the script run only if there is a page number posted to this scriptif(isset($_POST['pn'])) { $rpp = preg_replace('#[^0-9]#', '', $_POST['rpp']); $last = preg_replace('#[^0-9]#', '', $_POST['last']); $pn = preg_replace('#[^0-9]#', '', $_POST['pn']); // This makes sure the page number isn't below 1, or more than our $last page if ($pn < 1) { $pn = 1; } else if ($pn > $last) { $pn = $last; } // Connect to our database here include_once("connect.php"); // This sets the range of rows to query for the chosen $pn $limit = 'LIMIT ' .($pn - 1) * $rpp .',' .$rpp; // This is your query again, it is for grabbing just one page worth of rows by applying $limit $sql = "SELECT id, navn FROM data ORDER BY id DESC $limit"; $query = mysqli_query($con, $sql) or die(mysqli_error($con)); $dataString = ''; while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) { $id = $row["id"]; $navn = $row["navn"]; $dataString .= $id.'|'.$navn.'||'; } // Close your database connection mysqli_close($con); // Echo the results back to Ajax echo $dataString; exit(); } ?>
-
i was reading ajax in w3schools, and saw the example of callbacks functions, but i didnt get it. What does a callback function do. I tried searching a little but found no examples.
-
ajax
in JavaScript
what does it mean by saying "when a cached file is not an option"?
duplicate audio tags
in HTML/XHTML
Posted
this code shows me duplicate audio tags, why?
$mp3 .= "<audio width='320' height='240' controls>n"; $mp3 .= "<source src='$file_url' type='audio/mpeg'>n"; $mp3 .= "</audio>n"; $show .= "<div>n"; $show .= "$mp3 <br> Tittel: $tittel <br>n <span style='float:left;'>Description:</span>n <div style='border:1px red solid;overflow:hidden;width: 100px; height:20px;'>$description</div>n"; $show .= "</div>n <br>";
it is supposed to show 1 file form the DB then a break line, but instead shows 2 of the same audio on line with each other.