...

View Full Version : article not sending throgh mail()



keissfootball
06-13-2006, 08:25 PM
Hello, I have a problem with a php script which firstly shows article, and than if user wants to send it to someone else, clicks on a link, which displays a form where this user enters email, name etc of the other user to whom he wants to send the article. Everything's perfect except the part that the article from the database isn't sent to the email ($info .= "Ziņa:\n".stripslashes($_POST['zinja'])."\n"; - this part of $info. is the only which isn't sent, in the email I receive only Ziņa:). Look at the code, hope you can help.

Code: http://paste.php.lv/3908
Code without line number: http://paste.php.lv/3908/nonum

Rich Pedley
06-13-2006, 09:25 PM
I can't see the accompanying form element for $_POST['zinja'] ! But i think you may have access to $zinja (line 19).

keissfootball
06-13-2006, 09:54 PM
Sorry this wasn't the code version, this is is: http://paste.php.lv/3901

Rich Pedley
06-14-2006, 09:38 AM
so which bit isn't working in that version? The code you originally quoted doesn't appear, so far as I can see!

keissfootball
06-14-2006, 12:14 PM
The line 91 doesn't work ($info .= "Ziņa:\n $rezultats2[0] \n";) It works on the line 22, when I display the article, but if I want to send it - no result in email message, just a blank field in the place of an article.

Rich Pedley
06-14-2006, 01:20 PM
line 10 is part of the problem, along with line 31.

You aren't pulling anything from the database after you submit the form, as there is no $_GET["vairak"]

You could try adding it to the action of the form, or passing it as a hidden input,. If using the second method with name 'vairak', you'll have to check the $_POST['vairak'] after the form has been submitted.

keissfootball
06-14-2006, 01:34 PM
Do you want me to change this line

switch($raksts){
case "forma": echo"<FORM method=\"POST\" action=\"vairak.php?raksts=sutit&vairak='.$vairak.'\">

like this?

It isn't working either, maybe because my results are displayed in cycle?

Rich Pedley
06-14-2006, 02:30 PM
you currently have:
echo"<FORM method=\"POST\" action=\"vairak.php?raksts=sutit\">

you'd need that amending to:
echo "<FORM method=\"POST\" action=\"vairak.php?raksts=sutit&vairak=$vairak\">
(slightly different to what you posted.

see if that works.

keissfootball
06-14-2006, 03:23 PM
No, it didn't work but I tried your second variant, I added extra field:

<input type=\"hidden\" name=\"zinja\" value=\".$rezultats2[0].\">

//--> lower

@$zinja=$_POST['zinja'];

//--> lower
$info .= "Ziņa:\n $zinja \n";

I don't know why I receive .. in the place of an article ?

Edit: I got it, it's the 2 dots from here value=\".$rezultats2[0].\" but how can I give my variable to the switch part?

Rich Pedley
06-14-2006, 05:05 PM
can you repost your script again.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum