dtlrp119999 2013-08-04 19:57
浏览 20

可以回显sql查询结果但不能在mailto()中用作变量

I am a php newbie, but I'm trying to learn and I have been trying to fix this issue for over a week with loads of variations tried.

Short story - I query a db for an email address that I want to use in a form mail() function. I can echo the email on the page (just to check I'm querying OK).. but no email is sent. I've read all the php tutorial pages and hundreds of forums posts, I think that my issue is that $cemail is an object not a string?

On the mail() function I have 2 lines, one using the $cemail and one going to a fixed address. I receive the fixed address email, so I know the form is working.

The post form send verification reports an empty variable though - :(

Your message was sent to us successfully. ><

            // retrieve link data

            $userid = $_GET['userid'];

            // connect to DB

            $con=mysqli_connect("xxxxx","xxxxx","xxxxxx","xxxxxxxxx");

            $result = mysqli_query($con,"SELECT email FROM wp_participants_database WHERE id = '$userid'");
            $row = mysqli_fetch_array($result);
            $cemail = $row['email']; 


            {
            echo  $cemail;
            }

......

                mail($cemail,$subject,$emailbody,$headers);
    mail("example@email.com",$subject,$emailbody,$headers);



            ?>
            <div>
                <p class="alert alert-success"><?php _e('Your message was sent to us successfully. >' . $cemail .'<', _THEME); ?></p>

This is a site I'm creating for the wife... and I've spent many hours banging my head against this already - any help is much appreciated! :)

Thanks

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法