dqouryz3595 2017-04-07 16:20
浏览 24
已采纳

如何将字符串附加到表单字段中的数据

I have a form and I need a way of ensuring that only people with a particular email address can successfully signup. For example the only users allowed are from foo.com, so every email address should be like myemail@foo.com. Now I want the user to only have to enter the email user name and after the form is submitted I add the @foo.com using php. How would I go about implementing such a feature and if there is a better way to achieve the desired result where can I find such information . Thanks.

  • 写回答

3条回答 默认 最新

  • dougan4884 2017-04-07 16:23
    关注

    Easy, name the form field username for example. Name your submit button submit for example

    then on form submit

    if(isset($_POST['submit'])){
    $username = $_POST['username'];
    $username .= "@foo.com"   // jacksperro@foo.com
    
    // rest of your code
    }
    

    On a note, I'd put a label after the input box saying '@foo.com' to let them know to only type their username

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.