Jump to content

hasjem

Members
  • Posts

    11
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

hasjem's Achievements

Member

Member (2/5)

0

Reputation

  1. I have tried to make my site look 'better.' acoording to relatives it was outdated. so i used a template and it looks ok. but when i want to insert php the browser says there was a server mistake. I include two files, one without the connectdatabase part, which works , and one with the connectdatabase parts, which doesn't work. i tried to put it in differentplaces in the working file, but....sigh startprojektworking.php
  2. i picked this up from the internet, it is simple, but not working. why not? <div align="center" id="timeval">--:--:--</div> <button id="stop">Stop</button> <script src="jquery.js"></script> <script> $(document).ready(function() { //ajaxTime.php is called every second to get time from server var refreshId = setInterval(function() { $('#timeval').load('ajaxTime.php?randval='+ Math.random()); }, 1000); //stop the clock when this button is clicked $("#stop").click(function() { clearInterval(refreshId); }); }); </script> and as ajaxtime.php: <?php echo date("g:i:s A"); ?> and, yes, i uploaded jquery.js what is wrong? thanx lex
  3. I have the following script: <script type="text/javascript" src="prototype.js"></script> <script> new Ajax.Request("test.php", { method: 'post', postBody: 'naam='+ $F('naam')+'&name='+$F('name'), onComplete: showResponse }); } function showResponse(req){ $('show').innerHTML= req.responseText; } </script> <form id="test" onsubmit="return false;"> <input type="hidden" name="name" id="name" value="<?echo$volgnummer;?>"> <input type="hidden" name="naam" id="naam" value="<?echo$naam;?>"> <input type='hidden'name='wachtwoord' id="wachtwoord" value="<?echo$wachtwoord;?>"> <input type="submit" value="bieden" onClick="sendRequest()"> </form> <div id="show"></div> and for checking the following phpfile <?php echo "you typed ".$_POST["naam"]; echo "you typed ".$_POST["name"]; ?> now the problem is this part: postBody: 'naam='+ $F('naam')+'&name='+$F('name'), it only sends the first parameter, "naam" and not the second. what should the postbody look like to show more then one parameter? thanx lex moen
  4. I am busy learning ajax and i picked up a "simple" script from the internet. if i understand this i can alter it and use it. but it doesn't work and i do not see why. if i have a working script i can go on but as long as i do not understand why it isn't working.... who can point the mistake? <script language="JavaScript" type="text/javascript"> function ajaxRequest(){ var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken) for (var i=0; i<activexmodes.length; i++){ try{ return new ActiveXObject(activexmodes) } catch(e){ //suppress error } } } else if (window.XMLHttpRequest) // if Mozilla, Safari etc return new XMLHttpRequest() else return false } </script> <script language="JavaScript" type="text/javascript"> var mygetrequest=new ajaxRequest() mygetrequest.onreadystatechange=function(){ if (mygetrequest.readyState==4){ if (mygetrequest.status==200 || window.location.href.indexOf("http")==-1){ document.getElementById("result").innerHTML=mygetrequest.responseText } else{ alert("An error has occured making the request") } } } var namevalue=encodeURIComponent(document.getElementById("name").value) var agevalue=encodeURIComponent(document.getElementById("age").value) mygetrequest.open("GET", "basicform.php?name="+namevalue+"&age="+agevalue, true) mygetrequest.send(null) </script> <form method="get" action=""> Your name: <input type="text" id="name" name="name" size="25" /> <br /> Your age: <input type="text" id="age" name="age" size="25" /> <br /> <input type="button" value="submit" onClick="ajaxget()" /> </form> <div id="result"> </div> and as basicform.php: <? $name=htmlspecialchars($_GET['name']); $name=stripslashes($name); $age=(int)$_GET['age']; echo "<span style='color:red'>Welcome <b>$name</b> to JavaScript Kit. So you're <b>$age</b> years old eh?</span>"; ?>
  5. I want the script to change some values in a mysqldatabase when clicked. but in this way it doesn't work the echostatements inside the onclick doesn't work either. what should be changed? thanks lex
  6. I have a sceript which should work twice a second, but it stops after one pick up of information from the mysqldatabase. it should take a look in the database to see whether a name has changed without refreshing the page. what is wrong? <? $select="select *from aanbiedingen where volgnummer=$volgnummer"; $res=mysql_query($select); $row=mysql_fetch_array($res); echo$row[naam];echo('ppp'); ?> <span id="bieder"></span> <script language="JavaScript" type="text/javascript"> <!-- var d = 500; // Tijd in milliseconden var bieder = document.getElementById('bieder'); var hoogstebieder = "<?echo$row[naam];?>"; function lus() // De functie die in een lus zal worden uitgevoerd { <?$selekt1="select *from aanbiedingen where volgnummer=$row[volgnummer]"; $selektres1=mysql_query($selekt1); $row1 =mysql_fetch_array($selektres1);?> hoogstebieder="<?echo$row[hoogstebieder];?>"; bieder.innerHTML = hoogstebieder; // Waarde weergeven in de WaardeSpan setTimeout("lus()", d); // De functie binnen Tijd milliseconden nog eens uitvoeren } lus(); // De lus starten //--> </script>
  7. i am looking for a script which can show a digital clock that counts down, i should give in a timestamp and then it shows the days and hours and seconds till zero. anyone an idea? thanks lex
  8. I have a working script which uploads pictures to the server in a folder named images. but I want also the path to the picture to be found in a mysqldatabase table so I can find the location of a picture e.g. images/12345678.jpg i have this script, the path is under $newname, but I don't know how to send this $newname to the next page so i can put it in the database <?php //define a maxim size for the uploaded images in Kb define ("MAX_SIZE","100"); //This function reads the extension of the file. It is used to determine if the file is an image by checking the extension. function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } //This variable is used as a flag. The value is initialized with 0 (meaning no error found) //and it will be changed to 1 if an errro occures. //If the error occures the file will not be uploaded. $errors=0; //checks if the form has been submitted if(isset($_POST['Submit'])) { //reads the name of the file the user submitted for uploading $image=$_FILES['image']['name']; //if it is not empty if ($image) { //get the original name of the file from the clients machine $filename = stripslashes($_FILES['image']['name']); //get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); //if it is not a known extension, we will suppose it is an error and will not upload the file, //otherwise we will do more tests if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { //print error message echo '<h1>Unknown extension!</h1>'; $errors=1; } else { //get the size of the image in bytes //$_FILES['image']['tmp_name'] is the temporary filename of the file //in which the uploaded file was stored on the server $size=filesize($_FILES['image']['tmp_name']); //compare the size with the maxim size we defined and print error if bigger if ($size > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } //we will give an unique name, for example the time in unix time format $image_name=time().'.'.$extension; //the new name will be containing the full path where will be stored (images folder) $newname="images/".$image_name; //we verify if the image has been uploaded, and print error instead $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; }}}} thanks lex
  9. when people sign up they have to give an emailaddress. I want to send an email to that address with the question to click a link to make sure that emailaddress belongs to the user. how do i do that? thanks lex
  10. I have the following form to upload a picture, that works <form name="newad" method="post" enctype="multipart/form-data" action=""> <table> <tr> <td> <input type="file" name="image"> </td> </tr> <tr> <td> <input type='hidden' name='naam' value"<?echo$naam;?>"> <input type='hidden' name='wachtwoord' value"<?echo$wachtwoord;?>"> </td> </tr> <tr> <td><center> <input name="Submit" type="submit" value="Upload afbeelding"></center> </td> </tr> </table> </form> but in this way the hidden information (username and password) are not send. how can I do that? probably comes because of enctype="multipart/form-data" but i need that to send the picture. how do i send a picture AND the userinformation? thanks lex moen
×
×
  • 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.