Where are You, GreyHead ?
I created 2 forms chronoform following to input data to my database :
First form : Huyen (tenhuyen,mahuyen)
Code HTML :
First form no problem.
Second form : Tram (matram,tentram,mahuyen,machinhanh,masohuu,makhuvuc,ngayvanhanh ) I want input data by this form, But the data of mahuyen field is GET from mahuyen of First .
Code HTML :
I have added the Php Code in the seconde form .
It don't work . Please help me
I created 2 forms chronoform following to input data to my database :
First form : Huyen (tenhuyen,mahuyen)
Code HTML :
<div class="form_item">
<div class="form_element cf_heading">
<h1 class="cf_text">Nhập thông tin Huyện</h1>
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label">Mã Huyện</label>
<input class="cf_inputbox required" maxlength="150" size="30" id="text_1" name="mahuyen" type="text" />
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label">Tên Huyện</label>
<input class="cf_inputbox required" maxlength="150" size="30" id="text_2" name="tenhuyen" type="text" />
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Add" type="submit" /><input type="reset" value="Reset"/>
</div>
<div class="clear"> </div>
</div>
First form no problem.
Second form : Tram (matram,tentram,mahuyen,machinhanh,masohuu,makhuvuc,ngayvanhanh ) I want input data by this form, But the data of mahuyen field is GET from mahuyen of First .
Code HTML :
<div class="form_item">
<div class="form_element cf_heading">
<h1 class="cf_text">Nhập thông tin trạm</h1>
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label">Mã Trạm</label>
<input class="cf_inputbox required" maxlength="150" size="30" id="text_3" name="matram" type="text" />
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label">Tên Trạm</label>
<input class="cf_inputbox required" maxlength="150" size="30" id="text_2" name="tentram" type="text" />
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label">Mã Huyện</label>
<?php
$link = mysql_connect("localhost", "root", "");
mysql_select_db("dienluc", $link);
$result = mysql_query("SELECT mahuyen FROM dl_huyen", $link);
$row = mysql_fetch_array($result, MYSQL_ASSOC))
<select class="cf_inputbox validate-selection" id="select_10" size="1" name="mahuyen">
<option value="">Choose Option</option>
<option value="$row["mahuyen"]">$row["mahuyen"]</option>
</select>
mysql_free_result($result);
?>
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label">Mã Chi Nhánh</label>
<select class="cf_inputbox validate-selection" id="select_11" size="1" name="machinhanh">
<option value="">Choose Option</option>
<option value="ĐL1">ĐL1</option>
<option value="TB1">TB1</option>
<option value="DX1">DX1</option>
</select>
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label">Sở Hữu</label>
<select class="cf_inputbox validate-selection" id="select_13" size="1" name="masohuu">
<option value="">Choose Option</option>
<option value="KH">KH</option>
<option value="ĐL">ĐL</option>
</select>
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label">Khu Vực</label>
<select class="cf_inputbox validate-selection" id="select_12" size="1" name="makhuvuc">
<option value="">Choose Option</option>
<option value="KV1">KV1</option>
<option value="KV2">KV2</option>
<option value="NT">NT</option>
</select>
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label">Ngày Vận Hành</label>
<input class="cf_inputbox validate-date" maxlength="150" size="30" id="text_4" name="ngayvanhanh" type="text" />
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Add" type="submit" /><input type="reset" value="Reset"/>
</div>
<div class="clear"> </div>
</div>
I have added the Php Code in the seconde form .
It don't work . Please help me
Hi tonythuan,
This is a PHP 101 problem!!
[list]PHP statements must end in a ; Blocks PHP statements must be enclosed in <?php . . . ?> tags and separated from 'pure' html To output html inside a PHP block you must 'echo' or 'print' it (or close the php block to return to html) Similarly to output PHP variables inside html you must enclose them in <?php . . . ?> tags like [/list]
Bob
PS And for preference and security use Joomla code to work with your database tables
This is a PHP 101 problem!!
[list]
<?php echo $some_variable; ?>
Bob
PS And for preference and security use Joomla code to work with your database tables
Hi GreyHead !
thank you to your answer. Please Understand me !v
I have a few Skill PHP,i hope you help me this problem .
Thank a lot !
thank you to your answer. Please Understand me !v
I have a few Skill PHP,i hope you help me this problem .
Thank a lot !
Hi tonythuan,
I'm sorry - it really isn;t practical to run basic tutorials in PHP here. There ae many on the net - here for example.
Very happy to try and help with ChronoForms problems . . . but these aren't ChronoForms problems.
Bob
I'm sorry - it really isn;t practical to run basic tutorials in PHP here. There ae many on the net - here for example.
Very happy to try and help with ChronoForms problems . . . but these aren't ChronoForms problems.
Bob
Hi Greyhead !
I created the second form successfully .
it can GET data of field mahuyen from first form.
But i have a problem : the data of field mahuyen of second can't saved, the others field are saved OK .
CODE SECOND FORM :
I created the second form successfully .
it can GET data of field mahuyen from first form.
But i have a problem : the data of field mahuyen of second can't saved, the others field are saved OK .
CODE SECOND FORM :
<div class="form_item">
<div class="form_element cf_heading">
<h1 class="cf_text">Nhập thông tin trạm</h1>
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label">Mã Trạm</label>
<input class="cf_inputbox required" maxlength="150" size="30" id="text_3" name="matram" type="text" />
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label">Tên Trạm</label>
<input class="cf_inputbox required" maxlength="150" size="30" id="text_2" name="tentram" type="text" />
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label">Mã Huyện</label>
<?php
$database="dienluc";
mysql_connect ("localhost", "root", "");
@mysql_select_db($database) or die("Unable to select database");
?>
<select id="select_10" size="1" name="mahuyen">
<?php
$result=mysql_query("select mahuyen from dl_huyen");
while ($row=mysql_fetch_array($result)){
$mahuyen=$row['mahuyen'];
?>
<option value=""><? echo $mahuyen; ?></option><?}?>
</select>
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label">Mã Chi Nhánh</label>
<select class="cf_inputbox validate-selection" id="select_11" size="1" name="machinhanh">
<option value="">Choose Option</option>
<option value="ĐL1">ĐL1</option>
<option value="TB1">TB1</option>
<option value="DX1">DX1</option>
</select>
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label">Sở Hữu</label>
<select class="cf_inputbox validate-selection" id="select_13" size="1" name="masohuu">
<option value="">Choose Option</option>
<option value="KH">KH</option>
<option value="ĐL">ĐL</option>
</select>
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label">Khu Vực</label>
<select class="cf_inputbox validate-selection" id="select_12" size="1" name="makhuvuc">
<option value="">Choose Option</option>
<option value="KV1">KV1</option>
<option value="KV2">KV2</option>
<option value="NT">NT</option>
</select>
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label">Ngày Vận Hành</label>
<input class="cf_inputbox validate-date" maxlength="150" size="30" id="text_4" name="ngayvanhanh" type="text" />
</div>
<div class="clear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Add" type="submit" /><input type="reset" value="Reset"/>
</div>
<div class="clear"> </div>
</div>
Hi,
this line:
should be:
Cheers
Max
this line:
<option value=""><? echo $mahuyen; ?></option><?}?>
should be:
<option value="<? echo $mahuyen; ?>"><? echo $mahuyen; ?></option><?}?>
Cheers
Max
Hi Admin,!
thank you to your respon.
I can save data successfully .
But I Give a Error :
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
And a warning : Warning: Invalid argument supplied for foreach() in D:\DOANTOTNGHIEP\xampp\htdocs\dienlucqn\plugins\system\jfdatabase.php on line 154
Please, Help me de-bug this .
thank you to your respon.
I can save data successfully .
But I Give a Error :
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
* Error Loading Modules
And a warning : Warning: Invalid argument supplied for foreach() in D:\DOANTOTNGHIEP\xampp\htdocs\dienlucqn\plugins\system\jfdatabase.php on line 154
Please, Help me de-bug this .
Hi, only when you publish this field it gives the errors, is this a primary key ?
Regards,
Max
Regards,
Max
This topic is locked and no more replies can be posted.