adam.adamski.96155 43 Junior Poster

I tested your code on my local windows machine:

$file = "testFile.txt";
$fh = fopen($file, 'a+') or die("can't open file");
$firstname = "firstName"; $lastname = "lastName"; $mood = "mood";
$datestring = date("d/m/y ");
$timestring = date("H.i.s");
$data   = "$firstname ; $lastname ; $mood ; $datestring : $timestring\r\n" ;
$data  .= "$firstname ; $lastname ; $mood ; $datestring : $timestring\r\n" ;
fwrite($fh, $data);
fclose($fh);

and it printed:

firstName ; lastName ; mood ; 19/10/12  : 12.00.35
firstName ; lastName ; mood ; 19/10/12  : 12.00.35

to the testFile.txt
I also tested it on my remote unix based host and it gave exactly the same result. Maybe I can see all the code concerned?

adam.adamski.96155 43 Junior Poster
$data = "$firstname ; $lastname ; $mood ; $datestring : $timestring\r\n";
adam.adamski.96155 43 Junior Poster

Hey, great job!
It's good to be part of a success story :D

adam.adamski.96155 43 Junior Poster

If there is only one input or drop box how will their be more than one file to merge?
You could use a multi-select element:
http://www.w3schools.com/tags/att_select_multiple.asp
The drag and drop looked good, was lightweight to code and I don't see a problem with 25 pdfs :)

adam.adamski.96155 43 Junior Poster
adam.adamski.96155 43 Junior Poster

On line 75 the action of the form is malformed.
You have duplicate id's on the list elements.
When the form is submitted, you need to check the variables exist and are in the correct format before you use the merge function.

adam.adamski.96155 43 Junior Poster

Ok, I don't know if I can help but posting the code can only help. I can see from the error 'Could not locate PDF on ''', and addPDF('', 'all') that the pdf to add variable is not assigned.

adam.adamski.96155 43 Junior Poster

How are you stumped? What did you try?
If you use a select menu for the choosing of the .pdfs to be merged, and a submitted form to carry the choices to a processing function it's relatively simple.
You need to use javascript for the drag and drop, and to update the form variables before posting, it's certainly more complicated.

adam.adamski.96155 43 Junior Poster

It's possible using Javascript.
Add the onblur event to the text box and attach it to a function that replicates the textbox value in the textarea.

adam.adamski.96155 43 Junior Poster

the Email don't go at all to the users

Does this mean that no users ever get an email? Or does it mean that not all users get a mail, but some users get a mail?

adam.adamski.96155 43 Junior Poster

Hey again :)
line 119:
action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>
PHP parses the variable $_SERVER['PHP_SELF'] and echoes the current URL as the action, so whatever you name the file, the correct URL will be in the action declaration.
Now you want that to stay the same, but to add some more text to it also (it's called concatenation where you extend a string).

$string = "this" . " is"  . " a " . "string";
echo $string; //outputs "this is a string"

So you need to concatenate $_SERVER['PHP_SELF'] and "?ID=" and $_GET['ID']
Look here for some more info on concatenation - http://webdesignertutorials.com/tutorials/concatenating-php-strings.html and post back if you have any more problems.
Good luck! :D

adam.adamski.96155 43 Junior Poster

Sorry if I am patronising, but are you sure your server supports short tags (line 120)?
<?= "blah blah" ?> won't work on some servers,
<?php echo "blah blah"; ?> works on all.
Can we see the page?

adam.adamski.96155 43 Junior Poster

Hey again :)
First, good job with the pages showing your testing!
You send the variable via the URL so it must be retrieved via the $_GET array on the test.php page. This works fine with the link you have at the bottom of the page because the &name=value pair is certainly passed in the link. However, when the form is submitted using the submit button the $_GET variable is not available. This is because the &name=value pair is not in the url.
So how does the form page know know where to redirect to when it is submitted? Because the URL is in the action declaration of the form - action="/test.php". So if you want to take a variable from the url, you could add it to the action - action="/test.php?foo=bar", which will acheive the desired effect.
The problem is that you are declaring the variable on the outer page (presumably index.php), and then trying to collect that variable in delete.php, this will never work because the variable was never available to the page delete.php with the submit button.
Hope this helps, let us know how you get on.

adam.adamski.96155 43 Junior Poster

Hey that's great! Be aware that $_GET is a global by default, so you could reference it in your function, also you could have passed the variable to the function (prefered method) -

function delete($file){//everytime you want function to access variable... 
    if (unlink($file)){//it must referenced by the variable in the function declaration - ($file).
    //do functionary things
    }
}

and call the function with the variable passed:

$filename = $_GET['filename'];//define $filename
delete($filename);//send $filename to function.

You could also have passed $_GET['filename'] to the function -

delete($_GET['filename']);

Well done :D

bradly.spicer commented: Helpful :) +0
adam.adamski.96155 43 Junior Poster

Are you sure no variable is included in the name? In my gmail it hides the email address from me and only shows me the name of the sender. What if you hard code the from address, does it show then? What mail class are you using? Can you point us to the website?

adam.adamski.96155 43 Junior Poster

You have discovered variable scope:
http://www.homeandlearn.co.uk/php/php8p2.html
http://www.w3schools.com/php/php_variables.asp
See if you can work it out, let me know if you get stuck :)
Good luck!

adam.adamski.96155 43 Junior Poster

There are two methods available with a HTML form, "get" and "post". If the form is using get method, the variables will be in the $_GET array for PHP to use, but they will also be in the URL in &name=value pairs. If the form is "post" method, the variables will be in the $_POST array and not in the URL.

adam.adamski.96155 43 Junior Poster

It stopped putting your variables into the URL when you changed from get to post. Have a look at the code that declares $filename, the problem is clear :D

adam.adamski.96155 43 Junior Poster

Haha, good to see you still at it :D
This one problem is simple, you added a 'get' method to the form, yet I told you to echo 'post', you can either change the form method to post, or the variable to $_GET.

adam.adamski.96155 43 Junior Poster

Index.php - fix your HTML tags, you close the page before you open it. You haven't named your select element and won't be able to access the selected file. Your form has no method.
Delete.php looks ok, but fix index before you worry about it.
You should write print_r($_POST); die(); at the top of delete.php and don't remove it until you see the filename as you want it to be sent to the function.

You need to learn how to build a form in HTML, then how to grab the data entered using PHP. This is the bread and milk of PHP, there are multitudes of tutorials online.
Good luck! :D

adam.adamski.96155 43 Junior Poster

Is it possible that the script you are using has a place to add valid recipients as an attempt to stop somebody using your form as a mailshot device? The error could mean that the script has received the email address and it is not malformed, but that it is not on the list of valid recipients. The only other thing I can think is that method requires your input to be quoted - "<$_GET['ID']>", but that would be unusual I think. You could kill the script in the class itself - echo $_GET['ID'] on the first line of the AddToAddr() and see what the value is. Maybe if you post the contents of the class that contains the method we an see more.

adam.adamski.96155 43 Junior Poster

Ok, when you hard coded the email address, did you put <> either side (<me@mydom.com>), or just the address in quotes ("me@mydom.com")?
If the first instance, you need to concatenate "<".$_GET['ID'].">", if the second instance, I have no idea what the problem is without seeing the addresses that you are using.
I do have one doubt in my mind, and that is the fact that the form is in an iframe, but you are able to echo the necessary variable on the necesary page so...

adam.adamski.96155 43 Junior Poster

What happened to the solution on this thread:
http://www.daniweb.com/web-development/php/threads/435792/help-with-php-form-to-use-variable-as-email-address ?
Is it a different problem now?
I notice on the previous thread the format was 'name<address@domain.com>', yet here you are just putting the address itself, is that correct?

adam.adamski.96155 43 Junior Poster

Hey there, you want to use the audio tag? I had a play with the w3schools page try-it: http://www.w3schools.com/tags/tag_audio.asp
Using the editor I used this code -

<!DOCTYPE html>
<html>
<body>

<audio autoplay="true">
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mp3">
  Your browser does not support the audio element.
</audio>

</body>
</html>

and found that
Firefox 15.01 will play the ogg, but not the mp3.
IE8 won't play anything.
Chrome (Version 22.0.1229.92 m) will play both.

adam.adamski.96155 43 Junior Poster

Ok, then it must be the email address contained in the $_GET['ID'], I would run the form as normal a few times but echo the $_GET['ID'] to see what the exact value is.

adam.adamski.96155 43 Junior Poster

Hey there, you really need to learn this step by step.
The first page is the form page that allows the user to select the file that is to be deleted. This page will have a submit button which when clicked will redirect to the URL specified in the action="delete.php" of the form tag.
delete.php needs to be ready to catch the data posted with the form, in this case, the filename to delete. Then it needs to check if the file/path actually exists and respond appropriately.
Take it step by step, check each part is working before you move on to the next stage. If you are really trying and get stuck, post your problems here and people will help.

adam.adamski.96155 43 Junior Poster

Hardcode the email address and see if that throws an error. If it's in a valid email format and it still throws an error, i would look at how the email addresses are validated in the class before sending.

adam.adamski.96155 43 Junior Poster

The email variable is posted in the URL so can be accessed via $_GET['ID'].

adam.adamski.96155 43 Junior Poster
foreach($cLists as $countryid) {
    $innerSQL = "SELECT country_name FROM country WHERE country_id=$countryid"; //get country name for each new entry.
    $query = "INSERT INTO country_wise_products (country_id, product_id, product_name, country_name) VALUES ('$countryid', '$product_id', '$pro_name', ($innerSQL))";

It doesn't make sense to me to have the country name in that table, as you already have a look-up table for countries and ID's, but if you want to do it, I think the above code is what you need. Backup your database before you let my code near your server and this will not work until you have added a new column to your DB profiled for text entry.

adam.adamski.96155 43 Junior Poster

Can you post your code up till now?

adam.adamski.96155 43 Junior Poster

Hey, glad you solved your problem, kudos to broj1 also, don't forget to mark thread as solved :D

adam.adamski.96155 43 Junior Poster

Have a look at the error mysql reports:

if (!$res = mysql_query($query)){
    echo mysql_error(); die();
    }

It should give you the specific problem.

adam.adamski.96155 43 Junior Poster

Line 30:

$query = 'INSERT INTO country_wise_products (coutry_id, product_id) VALUES ';

should be country_id (the 'n' is missing from country). But why no error to screen (unknown column)? Is there a file error_log in the folder you are running the scripts?

adam.adamski.96155 43 Junior Poster

The table opening tags, the header cells and the table closing tags need to be moved outside the while loop.

adam.adamski.96155 43 Junior Poster

I think the OP wants to know if he can store a PHP variable and a text string, in the mysql field. Presumably so that when he selects the data from the dbase, PHP parses the variable and changes it for the current date.

adam.adamski.96155 43 Junior Poster

It looks like a config error with your user/pass or you are trying to operate on a connection that wasn't established. Can you post the connection code being careful to mask the username and password?

adam.adamski.96155 43 Junior Poster

Can you not echo any errors to the screen?

$sql = "INSERT into test (idnum,title,content) VALUES ('$id','$title','$content')";
if (!$resulta = mysql_query($sql)){
    echo mysql_error();
    die();
    }

If not, can you not read the error log?

adam.adamski.96155 43 Junior Poster

The problem is with the $_GET['error'] variable - in one place it is $_GET in the next palce it is $GET without the underscore. You need the underscore in both instances, $GET is not the same as $_GET. Also you can send the message via the URL (the get method), but as Daniel shows the message can be given on the login page as presumably there is only one error message and therefore no need to carry it from one page to another?

adam.adamski.96155 43 Junior Poster

I think what Bachov is suggesting is that you have the file onlineand available for download, and you put the URL to the file into the body of the email. This is certainly the simplest way, but if you really want to send the file as an attachment these are two pages that came up on a google search for me:
http://www.finalwebsites.com/forums/topic/php-e-mail-attachment-script
http://www.webcheatsheet.com/php/send_email_text_html_attachment.php

adam.adamski.96155 43 Junior Poster

Haha, no problem, I did it many times.

adam.adamski.96155 43 Junior Poster

You have $client: $client = new SoapClient("http://localhost:8731/phpwcf/?wsdl");
and $Client: $response = $Client->ENtoJP($args);