我在某些特定的电脑上出现了这个错误,但是当我在另一台电脑上运行这个程序时,它会100%正常工作 我在各种系统上运行此代码,但有些系统会出错。 所以任何人都可以帮助我
请
提前谢谢你
<?php include('common/header.php');
$test=$_GET['id'];
if(isset($_GET['id'])){
if(isset($_GET['id'])){
$user_data=$db->SelectSingle("customer_details","cust_id=".$_GET['id'],"","");
}
}
$state=$db->SelectTable("state","","");
?>
<form class="form-horizontal" action="add_customerins.php" method="post">
<fieldset>
<div class="span5">
<legend>Customer Details</legend>
<div class="control-group">
<label class="control-label">Customer Name :</label>
<div class="controls">
<input type="text" class="input-large" name="cust_name" id="cust_name" value="<?=$user_data['customer_name'];?>" placeholder="Customer Name">
</div>
</div>
<div class="control-group">
<label class="control-label">Customer Address :</label>
<div class="controls">
<textarea class="span11" rows="3" name="cust_adr" id="cust_adr"><?=$user_data['customer_address'];?></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label">Customer E-mail :</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on">@</span><input type="text" value="<?=$user_data['customer_email'];?>" name="cust_email" id="cust_email" placeholder="Email Address" class=" ">
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Alternate E-mail :</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on">@</span><input type="text" value="<?=$user_data['cust_alt_email'];?>" name="alt_email" id="alt_email" placeholder="Alternate Email Address" class=" ">
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Customer Phone No. :</label>
<div class="controls">
<input type="text" class="input-large" value="<?=$user_data['cust_phone'];?>" name="cust_ph" id="cust_ph" placeholder="Phone No">
</div>
</div>
<div class="control-group">
<label class="control-label">Alternate Phone No. :</label>
<div class="controls">
<input type="text" class="input-large" value="<?=$user_data['cust_alt_phone'];?>" name="alt_ph" id="alt_ph" placeholder="Alternate Phone No">
</div>
</div>
<div class="control-group">
<label class="control-label">State :</label>
<div class="controls">
<select tabindex="1" class="span8" name="cust_st" id="cust_st" >
<option value="">Select State</option>
<?php if(count($state)>0){
foreach($state as $stat)
{ ?>
<option value="<?=$stat['stid'];?>"<?php if($stat['stid']==$user_data['state_id']){ echo "selected";}?>><?=$stat['state_name'];?></option>
<?
} }
?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label">Pincode :</label>
<div class="controls">
<input type="text" class="input-large" value="<?=$user_data['pincode'];?>" name="cust_pin" id="cust_pin" placeholder="Pincode">
</div>
</div>
</div>
<div class="span5">
<!-- BEGIN SAMPLE FORMPORTLET-->
<legend>Customer Tax Details</legend>
<div class="control-group">
<label class="control-label">VAT No. :</label>
<div class="controls">
<input type="text" class="input-large" value="<?=$user_data['cust_vat'];?>" name="vat_no" id="vat_no" placeholder="VAT No">
</div>
</div>
<div class="control-group">
<label class="control-label">TIN No. :</label>
<div class="controls">
<input type="text" class="input-large" value="<?=$user_data['cust_tin'];?>" name="tin_no" id="tin_no" placeholder="TIN No">
</div>
</div>
</div>
</fieldset>
<div align="center">
<input type="submit" name="submit" class="btn btn-info" value="Save" />
<input type="reset" name="reset" class="btn btn-danger" value="Reset" />
</div>
<input name="cstid" type="hidden" value="<?=$test;?>" />
<input name="MM_up_insert" type="hidden" value="insert_up"/>
</form>
答案 0 :(得分:1)
正如我在评论中所说,你错过了一个大括号( }
)。
这是导致问题的代码块:
<?php
if (count($state) > 0) {
foreach ($state as $stat) {
?>
<option value="<?= $stat['stid']; ?>"<?php
if ($stat['stid'] == $user_data['state_id']) {
echo "selected";
}
?>><?= $stat['state_name']; ?></option>
<?
} }
?>
注意最后一位?
<?
} }
?>
你正在使用php短标签,而你可能没有启用它们。 改为:
<?php
} }
?>
这应该可以解决你的错误