我在我的页面中使用了 php 代码,但它在 localhost 中不起作用,在我给出的文本框和选择框中显示了未定义的变量,如下所示:
$propertyid = ereg_replace("[^A-Za-z0-9-]", "", $_POST['propertyid']);
$propertyname = ereg_replace("[^A-Za-z0-9]", "", $_POST['propertyname']);
$propertytype = ereg_replace("[^A-Z a-z0-9]", "", $_POST['propertytype']);
$propertydealtype = ereg_replace("[^A-Z a-z0-9]", "", $_POST['propertydealtype']);
$propertystreet = ereg_replace("[^A-Z a-z0-9]", "", $_POST['propertystreet']);
<td width="249" align="left" valign="middle">PropertyID:</td>
<td width="739"><input name="propertyid" type="text" value="<?php echo "$propertyid"; ?>" /></td>
</tr>
<tr>
<td width="249" align="left" valign="middle">PropertyName:</td>
<td width="739"><input name="propertyname" type="text" value="<?php echo "$propertyname"; ?>" /></td>
</tr>
<tr>
<td align="left" valign="middle">Property Type:</td>
<td><select name="propertytype">
<option value="<?php echo "$propertytype"; ?>"><?php echo "$propertytype"; ?></option>
<option value="Appartment/Fla">Appartment/Flat</option>
<option value="Farm House">Farm House</option>
<option value="Guest House">Guest House</option>
<option value="Lord">Lord</option>
<option value="Hostel">Hostel</option>
</select></td>
</tr>
<tr>
<td align="left" valign="middle">Deal Type:</td>
<td><select name="propertydealtype">
<option value="<?php echo "$propertydealtype"; ?>"><?php echo "$propertydealtype"; ?></option>
<option value="For Sale">For Sale</option>
<option value="For Rent">For Rent</option>
<option value="For Lease">For Lease</option>
<option value="Ejara">Ejara</option>
<option value="Sar Qulfi">Sar Qulfi</option>
</select></td>
<tr>
<td align="left" valign="middle">Property Streeet:</td>
<td><input name="propertystreet" type="text" value="<?php echo "$propertystreet"; ?>" /></td>
</tr>
每当我在本地主机中执行时,每个盒子里面都会收到盒子里面的错误。