Go Back   SitePoint Forums > Forum Index > Program Your Site > PHP
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old Oct 18, 2006, 21:20   #1
albertochiang
SitePoint Member
 
albertochiang's Avatar
 
Join Date: Oct 2006
Location: Malaysia
Posts: 2
NEWBIE - Need help on FORM-POST

I have a file call "formisi.php"
<html>
<head>
<title>Form dan Elemen Form secara lengkap</title>
</head>

<body>
<h1>Form dan berbagai elemennya</h1>
<form name="form1" method="post" action="formhasil.php">
<table width="800" border="0">
<tr>
<td width="175">Nama</td>
<td width="615"><input type="text" name="nama" value="Maya" size="25" maxlength="50"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" value="" size="15" maxlength="25"></td>
</tr>
<tr>
<td>Gender</td>
<td><input name="gender" type="radio" value="L" checked>
Laki-laki --------
<input name="gender" type="radio" value="P">
Perempuan</td>
</tr>
<tr>
<td>Hobby</td>
<td><input type="checkbox" name="hobi1" value="Memancing">
Memancing</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="checkbox" name="hobi2" value="Belanja">
Belanja</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="checkbox" name="hobi3" value="Bersepeda">
Bersepeda</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="checkbox" name="hobi4" value="Naik Gunung">
Naik Gunung </td>
</tr>
<tr>
<td>Pekerjaan</td>
<td><select name="pekerjaan">
<option value="0">Pengangguran</option>
<option value="1">Wiraswasta</option>
<option value="2">Pegawai negeri</option>
</select></td>
</tr>
<tr>
<td>Komentar</td>
<td><textarea name="komentar" rows="3" cols="35"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="submit" name="kirim" value="Kirim">
<input type="reset" name="reset" value="Kosongkan">
</td>
</tr>
</table>
</form>
<p>&nbsp; </p>
</body>
</html>

and another file call "formhasil.php"
<html>
<head>
<title>Form Hasil</title>
</head>

<body>
<table width="800" border="0">
<tr>
<td width="159">Nama</td>
<td width="631"><?php echo "$nama"?></td>
</tr>
<tr>
<td>Password</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Gender</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Hobby</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Pekerjaan</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Komentar</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

after input data in formisi.php and press submit, I cannot read the variable $nama, it seems empty. whats wrong ? please help me ? Im just learn PHP.
albertochiang is offline   Reply With Quote
 

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 03:18.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved