adam.adamski.96155 43 Junior Poster

http://php.net/manual/en/function.xml-parse.php
I think the second user contributed note (Ashok dot 893 at gmail dot com) might be what you are looking for.

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 'wages' the error message refers to is the $_POST['wages']. The key ('wages'), as the error states, does not exist in the $_POST array.

<?php
$errorcount=0;

//add the following line to see if the $_POST array exists and what it contains.
print_r($_POST);

$wages=$_POST['wages'];
$hours=$_POST['hours'];
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

http://www.sitepoint.com/forums/showthread.php?605626-MySQLi-Parameter-Binding-Problems

This page gives a better explanation of your problem. It appears the method fetch_assoc doesn't exist with the object returned when you bind the parameters.

adam.adamski.96155 43 Junior Poster

The error is complaining that you are trying to use a class method when the class does not exist. This usually because you are trying to operate a method on a mis-typed class or non-instantiated class. Could it be the same problem another user had with the servers' mysql driver:
http://stackoverflow.com/questions/8321096/call-to-undefined-method-mysqli-stmtget-result

adam.adamski.96155 43 Junior Poster

I would guess that on line 38 of confirmation.php it says 'mysqli_stmt->' instead of '$mysqli_stmt->', but it would be better to see the file that gives the error.

adam.adamski.96155 43 Junior Poster

You need to use the string functions of php - http://php.net/manual/en/ref.strings.php - specifically, strpos, strlen, substr. Is this '$html->find('li') method part of a defined class? I think javascript is more suited to looping through DOM elements and grabbing the href location.

adam.adamski.96155 43 Junior Poster

I did the same thing that you are trying to acheive by using a function in an includes file that would work out and set a few page variables on page load just as Arctic said.

It's not the browser that looks for either .php or .html, it's the webserver that offers one or the other when a browser is pointed at an incomplete URL - www.mysite.com rather than www.mysite.com/index.html

I agree with your idea about the html includes not needing the php extension and causing the server to needlessl parse the HTML.

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

SELECT NULL FROM awards AS v ?

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

You can use Javascript to capture the onlcose event of the window and request that a user logs out properly, look at this page for instructions: http://royaltutorials.com/javascript-popup-onclose/
Also, you can have another field in your DB that records the time of the last action of the logged in user, and then when another user accesses your page, and you run the routine to show which users are logged in, it can drop any users that have been inactive for x minutes from the list of logged in users in the DB.

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

$your_email ='<" .$_GET['ID']. ">';

Your mistake was to mix the double and single quotes - "<" .$_GET['ID'] .">" works, and so does '<' .$_GET['ID'] .'>', but not the mixture that you have. You really need to learn how to concatenate strings as you have to do this very often in web pages and PHP and it is relatively simple.

adam.adamski.96155 43 Junior Poster

Hey, you are welcome :)

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

Hey, no problem, but did you get it working?

adam.adamski.96155 43 Junior Poster

There are many ways to acheive this, but it's best if you work this out yourself (teach a man to fish.)

<?php
$arr = array();
//make data connection and send query
while ($row = mysql_fetch_assoc($res)){//loop through all db rows
    $arr[] = $row['Name'].", ".$row['Age'].", ".$row['Country']."\n"; 
    //store each line in the array called $arr.
    }
//open the file ready for writing
//now loop through and write each line to file.
foreach($arr as $k => $v){
    //write $v to file
}
//close the file.
?>
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);

adam.adamski.96155 43 Junior Poster

Hey Anna. I duplicated your select element and button:

<?php
if ($_POST){print_r($_POST);}
$row = array('size'=>"one", 'size1'=>"two", 'size2'=>"three", 'size3'=>"four", 'size4'=>"five" );
?>
<form name="form" method="post" action="">
<select name="sel_size" id="sel_size">
<option value="<?php echo $row['size']; ?>"><?php echo $row['size']; ?></option>
<option value="<?php echo $row['size1']; ?>"><?php echo $row['size1']; ?></option>
<option value="<?php echo $row['size2']; ?>"><?php echo $row['size2']; ?></option>
<option value="<?php echo $row['size3']; ?>"><?php echo $row['size3']; ?></option>
<option value="<?php echo $row['size4']; ?>"><?php echo $row['size4']; ?></option>
</select>
<input name="submit" type="submit" value="submit">
<form>

When I choose a option then press the button, the page reloads and echos:

Array ( [sel_size] => four [submit] => submit ) 

Which is $_POST['sel_size'] with a value of 'four'.
The use of <select name="array[]"> is only for multi-select form elements.
I presume you are working with somebody else's script? Is the selected size supposed to be entered into a DB and all the current basket details taken from the DB? In which case, the selected size needs to be inserted into the database first.

adam.adamski.96155 43 Junior Poster

The empty form action will leave the action as the current page, like using $_SERVER['PHP_SELF'] and will make no difference to header("Location:index.php"). I replicated your setup:

<form name="form" method="post" action="">
<input name="submit" type="submit" value="submit"><form>

on one page, and

<?php if(isset($_POST)){ header("Location:newpage.php"); die(); } ?>

on the included page, and it redirected without any concatenation. Are you using a variable as the redirect location for the header function?

header("Location:".$redirect_page);

If so, I think the concatenation takes place there. If I have misunderstood, then please excuse me :)

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

Hey Anna, I'm still not sure what you want to achieve, but I think it is this line you need to change:

$output[] = '<td>'.$cartrow['sel_size'].'</td>';

to:

$output[] = '<td>'.$_POST['sel_size'].'</td>';

The script is trying to get the selected size from the database but the information has not been stored there yet? Rather the selected size is still in the $_POST array, presuming the 'method="post"' in the add to basket form.

adam.adamski.96155 43 Junior Poster
$data_email_sender->AddToAddr("name<" .$_GET['ID']. ">");

You don't need to echo the GET var as you are already in a PHP block.
Or for tidiness, you can build the string separately -

$str = "name<";
$str.= $_GET['id'];
$str.= ">";
$data_email_sender->AddToAddr($str);

Hope this helps.

adam.adamski.96155 43 Junior Poster

Anna, it's hard to work out what you actually want to achieve. It seems to me that you want to grab the selected size from the add to basket page and then carry that size onto the basket page and show it there also. In which case, you simply need to grab the $_POST['sel_size']/$_GET['sel_size'].
Use the $row['size'] for both the value and the user's text choice -

<select name="sel_size" id="sel_size">
<option value="<?php echo $row['size']; ?>"><?php echo $row['size']; ?></option>
<option value="<?php echo $row['size1']; ?>"><?php echo $row['size1']; ?></option>
</select>

If you want the variable available to javascript on the basket page, create a hidden variable in PHP on page load: <input type="hidden" id="selected_size" value="<?php echo $_POST['sel_size'];?">
Then access it using document.getElementById('selected_size').value
If I have misunderstood and told you something you learnt at kindergarten, please accept my apologies and ignore me :D