-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Very true, i had to assume he ment a main page that allowed to load the other pages before visiting them.. as i said i can't see any good reason for it, if i site is designed well then this approach is unneed and infact will be more wasteful for bandwidth and also slow down the whole sites loading. No disrespect intended!
-
need some help for my project(php gurus help me out!)
MadTechie replied to ray_nl's topic in PHP Coding Help
you could but the way its coded the confirm script doesn't really do anything except take you to another page (the data was already stored) also javascript can't send emails, so a simpler solution would be to send the mail when the data was stored and add the confirm to the submit button then have a redirect from the PHP 1. put the confirm script on the "Travel Air Home Page" page and add onclick="confirmation();" to the submit button. 1.1 change <FORM METHOD="POST" ACTION="booking_process.php"> to <FORM METHOD="POST" ACTION="booking_process.php" name="booking" > 1.2 change window.location = "Home.html"; to document.booking.submit(); (now you form will need to be confirmed before its processed) 2. edit booking_process.php to send email and goto home.html 2.1 after mysql_close($con); add mail("bookees@mail.com", "New booking", $_POST['first_name']."has booked blar"); 2.2 after 2.1 add header("Location: home.html"); 2.3 the problem: 2.2 will NOT work as you have output to the page and if it did work you won't see it as your being redirected.. so you need to remove it.. call page should be like this include 'connection string' $sql="INSERT INTO `table_name` (`firstname`, `lastname`) VALUES('$_post['first_name']', '$_POST['last_name']')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } mysql_close($con); mail("bookees@mail.com", "New booking", $_POST['first_name']."has booked blar"); header("Location: home.html"); Hope that helps -
Trouble correctly showing apostrophes when include()ing file
MadTechie replied to stickynote427's topic in PHP Coding Help
say thank you by clicking the topic solved.. and if possible evil turn magic quotes off -
I was going to say they have changed that in PHP 6, but looks like i don't have to now lol
-
google javascript pre-load image, you can use the same idea for CSS or JS but i hardly see a good the reason.
-
Not really, the problem is javascript can't control the file input (for security reasons), however a workaround would be to put the form in a iframe allows you to stay on the same page. if your also aiming for a processbar then again no luck php can't read how much data has been processed, a workaround for this is CGI script. and a small ajax to read the data recieved
-
If its a different page on the SAME site then just use sessions or cookies if its the same site or even another site you can use POST or GET (html forms) it its same site you could include the file and all values will work.. can you explain what your trying.
-
Shouldn't killing it be more like this <?php session_start(); $_SESSION = array(); setcookie(session_name("H1000"), '', time()-42000, '/'); setcookie(session_name("LUN"), '', time()-42000, '/'); session_destroy(); header('Location:index.php'); ?>
-
Why would it.. it sends what you tell it to send.. you have choosen to send So thats what it sends try this! $message = $_POST['Firstname'].' just registered check it out.';
-
Okay.. then just use mail() and add the $_POST's to the body!
-
You need to make sure the folders exist and have write access here's some sample code with a little error checking <?php foreach($_FILES['ufile']['name'] as $K => $Name) { $uploaddir= $_POST['gallery']."/"; //check folder path if(!is_dir($uploaddir)) die("Can't upload invalid folder path: $uploaddir"); $path= $uploaddir.$Name; //copy file to where you want to store file $valid = copy($_FILES['ufile']['tmp_name'][$K], $path); if($valid) { echo "File Name :$Name<BR/>"; echo "File Size :".$_FILES['ufile']['size'][$K]."<BR/>"; echo "File Type :".$_FILES['ufile']['type'][$K]."<BR/>"; echo "<img src=\"$path\" width=\"150\" height=\"150\">"; }else{ echo "failed: "; } echo "<P>"; }
-
#1 replace $HTTP_POST_FILES with $_FILES #2 $_POST['gallery'] = the folder name so $path1= "upload/".$HTTP_POST_FILES['ufile']['name'][0]; should be $path1= $_POST['gallery']."/".$_FILES['ufile']['name'][0];
-
Great just when i thought no one noticed lol, but i think everyone knew what i was getting at, however if you want to convert the file, then surly your need to download it first then convert then remove old one!
-
Code should look like this <?php $query = mysql_query("SELECT subject, COUNT(subject) AS Occurrences FROM nsnemailgr GROUP BY subject ORDER BY Occurrences DESC LIMIT 0 , 10") ; while ($topten = mysql_fetch_array($query)){ echo $topten['subject']." (".$topten['Occurrences']." times)<br>\n"; } ?>
-
arrray ? EDIT: ok you found it
-
thebadbad, script looks fine, but have you tried it without cURL ? it sometimes works and its very simple $remote = "http://remote_site.com/files/video.mpg"; $local = "path/to/storage/video.mpg"; file_put_contents($remote, $local); Also remember you need write access to the folder your storeing the file to.!
-
Try this SELECT subject, COUNT(subject) AS Occurrences FROM table GROUP BY subject ORDER BY Occurrences DESC LIMIT 0 , 10 change table to table name echo $row['subject']." (".$row['Occurrences']." times)"; EDIT: oops forgot the order (now added)
-
Your very welcome, if this is now solved can you please click topic solved (bottom left) i think!
-
<?php $line = '"john", "E-Commerce Integration", "Notes notes",,,,'; $line = trim($line,',"'); //remove , and " //it should now be 'john", "E-Commerce Integration", "Notes notes' $linearray = explode('", "',$line); //Get and array //or below /* $linearray should be array( john E-Commerce Integration Notes notes ) */ $sqlvalue = "'".implode("','",$linearray)."'"; //you need the first and last ' //$sqlvalue should be 'john','E-Commerce Integration','Notes notes' // i'll assume $fields are okay! $query = "insert into $databasetable ($fields) values($linemysql);";
-
I assume your delimiter or enclosure was incorrect it should be like this fgetcsv($handle, 1000, ",", '"') could you provide some sample data from the CSV file and show what you wish to keep/loss ie only remove the red
-
A CSV's data it like this "MadTechie","is great" and your doing this $arr = explode(",", $line); which Breaks it up into "MadTechie" and "is great" with the quote, This would remove the quotes $arr = explode('","', $line); But you should really use fgetcsv(), however, i don't see the point of using $arr = explode(",", $line); then implode("','", $arr) ."')"; when you could just do $sql = "insert into TABLENAME values ($line)";
-
Its not parsing the php, reasons #1 you don't have PHP running on the server #2 your file isn't of a PHP type (ie index.php should work but index.html will probably fail) depending on the file types
-
Input "image" buttons not working Internet Explorer
MadTechie replied to exelGram's topic in PHP Coding Help
Not solved.. it will fail in FireFox! -
How to identify if the input string is valid IP address format
MadTechie replied to bloodgoat's topic in Regex Help
Not true it captures all 4, of course you could use ^ + $ the RegEx works fine.. can you post a IP it fails with !! ie if (preg_match('/\A(?:^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$)\Z/im', $ip)) { echo "$ip passed"; } else { echo "$ip failed"; } -
Input "image" buttons not working Internet Explorer
MadTechie replied to exelGram's topic in PHP Coding Help
IE doesn't use the image values the same as FF, it append the XY positions a simple option would be to use GET ie <a href="blar.php?doLogin=Login"><img boader="0" src="Images/buttonLogin.png" /></a> if (array_key_exists('doLogin', $_POST)) { to if (array_key_exists('doLogin', $_GET)) {