/    Sign up×
Community /Pin to ProfileBookmark

get echo value to be displayed in mail body

Here is the code for displaying the success approval date which
retrieved from database:-

[code=php]<?php
if(isset($_POST[‘find’]))
{
$dateid = $_POST[‘find’];
$sql = “SELECT * FROM application as app
INNER JOIN success_app as appdate
ON app.app_id = appdate.app_id
WHERE app.app_id = ‘$appid’ AND app.date_id = ‘$dateid'”;
$result = mysql_query($sql);
echo “accept date:”.”<br/>”;
while($accept = mysql_fetch_assoc($result))
{
echo $accept[‘success_date’];
}
}
?>[/code]

how can i get the $accept[‘success_date’]; to be displayed in my php mailer body if my code
is as below:-

[code=php]$mailbody = $mailbody . “Success date :”.$_POST[‘date’].”n”;[/code]

i have tried with hidden input to get the value to be displayed, but failed to do so.
what about array? anyone can assist me on this?
thank you so much.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@GravyAug 13.2014 — I really have no idea what you're asking for here, I'm guessing it has something to do with sending emails?

But you do have a couple of other problems:

1) Don't use mysql_ functions, use mysqli_ or PDO. mysql_ is being removed from PHP.

2) You don't sanitize your variables before placing them in the SQL string. You are asking to be hacked! Never put user submitted data, for example from $_POST, $_GET or $_COOKIE directly into an SQL query.
Copy linkTweet thisAlerts:
@deathshadowAug 13.2014 — You are doing a join -- which table is it in? If it's in "application":, you need to use $accept['app.success_date']. If it's in "success_app" that would be $accept['appdate.success_date']

When you "as" a table, you have to prepend that "as" name to your value in the array.

When in doubt, output the result array so you can see all of it. echo '<pre>', print_r($accept), '</pre>'; for the win. Then you can see how it's stored and what it's returning during debugging.

-- edit --

Oh I should probably also read you the riot act about using mysql_ functions like it's still eight years ago, but I'm tired. I'll let the [url=http://php.net/manual/en/function.mysql-connect.php]GIANT RED WARNING BOXES IN THE MANUAL[/url] do that for me.
Copy linkTweet thisAlerts:
@noobie798authorAug 14.2014 — Hi, thanks for replies.

i have done it by using hidden input type and call by $_POST.

thanks alot ?
×

Success!

Help @noobie798 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...