06-13-2006, 09: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 without line number: http://paste.php.lv/3908/nonum
06-13-2006, 10:25 PM
I can't see the accompanying form element for $_POST['zinja'] ! But i think you may have access to $zinja (line 19).
06-13-2006, 10:54 PM
Sorry this wasn't the code version, this is is: http://paste.php.lv/3901
06-14-2006, 10: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!
06-14-2006, 01:14 PM
The line 91 doesn't work ($info .= "Ziņa:\n $rezultats2 \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.
06-14-2006, 02: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.
06-14-2006, 02:34 PM
Do you want me to change this line
case "forma": echo"<FORM method=\"POST\" action=\"vairak.php?raksts=sutit&vairak='.$vairak.'\">
It isn't working either, maybe because my results are displayed in cycle?
06-14-2006, 03: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.
06-14-2006, 04:23 PM
No, it didn't work but I tried your second variant, I added extra field:
<input type=\"hidden\" name=\"zinja\" value=\".$rezultats2.\">
$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.\" but how can I give my variable to the switch part?
06-14-2006, 06:05 PM
can you repost your script again.