문제

I need to put some predefined text into the hidden field in contact form and than send it to mail. But its not showing in mail. Any help? My form code is this:

<?php 
require('assets/dbconn.php');
$result = mysqli_query($con,"SELECT * FROM auctions WHERE id=$id");
$row = mysqli_fetch_array($result);
?>
<form  class="form" id="contactForm" method="post" enctype="multipart/form-data"  action='action.php'>
<label for="email" class="label_text">E-mail:<span class="required_sign">*</span></label>
<input id="email" name="email" class="required" type="email" />
<input type="hidden" name="code" value="<?php echo $row['CodeFromDB']; ?>" />
<button type="submit">SEND</button>
</form>
도움이 되었습니까?

해결책

You need to set the value attribute of the input MDN Input Reference

<input id="code" name="code" type="hidden" value="<?php echo $row['CodeFromDB']; ?>"/>

Also, verify that $row['CodeFromDB'] is not empty, either by echoing it, or using testing with php's empty() function.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top