-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
okay i only skimmed the code (1 minute look over) and it looks okay, however i would suggest you put a beta version live and leave open for testing, Beta Test Your Stuff! (also read the MUST read)
-
the file name must end in .PHP (unless you add a type to the php engine) and the script needs to know its contents type.. So you should end up with something like this <?php header('content-type:text/css'); echo "/*CSS CODE*/";
-
The reason i asked for an example was because the CR/NL works fine, and you refused to answer my question From your example it would seam that you have problems with the variables and not the CR/NL POC: change 'Item Name: ' . $supName . "\r\n" . to 'Item Name: ' . 'debug' . "\r\n" . and 'Shipping School: ' . $shipName . "\r\n" . to 'Shipping School: ' . 'debug'. "\r\n" . and check the formatting, if as i expect the formatting is find, then check the variables.
-
You need to post from the form to this script.. if your not seeing the form then you have loaded the wrong script or you have either not giving the full picture or $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); is wrong..
-
stuck- filter query from $_POST var in same form
MadTechie replied to dflow's topic in PHP Coding Help
That's because you are not selecting a $CountryName isn't being set from ant database reference ie $CountryName=$row_RsCountryDetails['CountryName']; -
Welcome, Love the upgrade vista to Linux quote,
-
stuck- filter query from $_POST var in same form
MadTechie replied to dflow's topic in PHP Coding Help
$_POST are set after the form is submitted.. so it won't be set! other than that i have no idea what your asking! -
whats the exact message your getting and whats $editFormAction set to ?
-
Nah!, that was to tomhoad, (Unique MP3 download link that links to a previous post (How do you provide a unique url that expires or prevent a user from accessing) LOL) worth a read
-
stuck- filter query from $_POST var in same form
MadTechie replied to dflow's topic in PHP Coding Help
Can you mark it as solved then (bottom left) -
When you have problems with an output, showing only the output hardly helps!
-
Do you have an example?
-
in addition, you could also add the time into the field ie $phptime = strtotime($_POST['day']."-".$_POST['month']."-".$_POST['year']." ".$_POST['time'] ); $date = date ("Y-m-d H:i:s", $phptime);
-
Ahhhhhh! Is May selected from a drop down box ? if so change the value to the month number ie May = 5 or replace $phptime = mktime(0,0,0,$_POST['month'],$_POST['day'],$_POST['year']); with $phptime = strtotime($_POST['day']."-".$_POST['month']."-".$_POST['year']); personally i would change the values (if possible)
-
define "flip flops the lines" also theirs nothing wrong with the code supplied, is the email text or html ?
-
It would seam the data is not being passed, add a echo "<pre>";var_dump($_POST); to the end of you code and post the results, Okay the apostrophes is due to magic quotes, if possible turn them off, a workaround is to add this code to the start if (get_magic_quotes_gpc()) { function magicQuotes_awStripslashes(&$value, $key) {$value = stripslashes($value);} $gpc = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); array_walk_recursive($gpc, 'magicQuotes_awStripslashes'); }
-
infact.. lets do this correctly change $date = $_POST['year']."-".$_POST['month']."-".$_POST['day']; to //Create unix timestamp $phptime = mktime(0,0,0,$_POST['month'],$_POST['day'],$_POST['year']); //convert to SQL datetime $date = date ("Y-m-d", $phptime); EDIT: added comments
-
can you add this line to the end of the code echo $insert; and also check the date field is a DATETIME type it should display something like this
-
oops typo it should be sprintf $insert = sprintf("INSERT INTO giglist (venue, town, postcode, date, time, age, noflier, flier, flierul, notes)
-
Huh!.. You use a force download script so the downloads are controlled by a PHP script, after the readfile function has been used you can simply unlink the file, if the script fails to complete the readfile() the the unlink will not be used thus the file remains, if the readfile() is complete then the unlink will be used thus removing the file! PS your initial caps button seams to be stuck!
-
stuck- filter query from $_POST var in same form
MadTechie replied to dflow's topic in PHP Coding Help
i assume you mean $CountryDetails = sprintf("SELECT * FROM country_list WHERE CountryID = %d", $_POST['CountryID']); -
Okay a few problems $select = "insert into giglist (venue, town, postcode, date, time, age, noflier, flier, flierul, notes) values ('{$_POST['venue']}','{$_POST['town']}','{$_POST['postcode']}','[$date]','{$_POST['time']}','{$_POST['age']}','{$_POST['noflier']}','{$_POST['flier']}','{$_FILES['image']['name']}','{$_POST['notes']}')"; first off, '[$date]' should be '$date', but the main problem is your not using that query.. it should be here if (!mysql_query($con)) so update it to this if (!mysql_query($select)) also i would of called it $insert instead of $select as its an insert in addition you are vulnerable to SQL Injection, I have made the changes and updated the whole script see below (it may not work as its untested) <meta http-equiv="refresh" content="10; URL=addgig.php"> <?php $con = mysql_connect("localhost","user","password"); if (!$con){ die('Could not connect: ' . mysql_error()); } mysql_select_db("hopelesssons", $con); if (!empty($_POST['day']) && !empty($_POST['month']) && !empty($_POST['year'])) { $date = $_POST['year']."-".$_POST['month']."-".$_POST['day']; }else{ die("Invalid date values supplied."); } $file = (!empty($_FILES['image']['name']))?$_FILES['image']['name']:""; $insert = sprinf("INSERT INTO giglist (venue, town, postcode, date, time, age, noflier, flier, flierul, notes) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", mysql_real_escape_string($_POST['venue']), mysql_real_escape_string($_POST['town']), mysql_real_escape_string($_POST['postcode']), $date, mysql_real_escape_string($_POST['time']), mysql_real_escape_string($_POST['age']), mysql_real_escape_string($_POST['noflier']), mysql_real_escape_string($_POST['flier']), mysql_real_escape_string($file), mysql_real_escape_string($_POST['notes']) ); $target_path = "fliers/"; $target_path = $target_path . basename( $_FILES['image']['name']); if(move_uploaded_file($_FILES['image']['tmp_name'], $target_path)) { echo "<p>The image has been uploaded successfully.</p>"; } else{ echo "<p>There was an error uploading the image, please try again!</p>"; } if (!mysql_query($insert)){ die('Error: ' . mysql_error()); }else{ echo "Record added successfully. You will shortly be redirected back to the previous page."; } mysql_close($con) ?>
-
Can you post the form as well.. and is "Connections/webform.php" for the database connection ? the error is due to the following code:~ $errmsg = ""; if (!isset($_POST['name']) || empty($_POST['name'])) $errmsg .= "<p>Please enter your name"; if (!isset($_POST['email']) || empty($_POST['email'])) $errmsg .= "<p>Please enter your email address"; if (!isset($_POST['mobile']) || empty($_POST['mobile'])) $errmsg .= "<p>Please enter your mobile phone number"; if ($errmsg!= "") { echo $errmsg; echo "<a href=\"javascript:history.back();\">Please go back and fill out the missing fields</a>"; exit; }else { echo "<p>success: all fields were filled out"; } you need to check the form uses POST and contains the following fields name, email & mobile
-
How are you using the script ? what browser. what popup blocker. example of the problem ?
-
Displaying a record from mysql in a simple swf file
MadTechie replied to spenceddd's topic in PHP Coding Help
Did you try the example without any change first, then update the PHP and update a little at a time?