Anyone can help me how to get data from one page to other page?
here code :

<form action="" method="post">
 <input type="hidden" name="id" value="<?php echo $id; ?>"/>
 <div>
 <p><strong>ID:</strong> <?php echo $id; ?></p>
 <strong>Nik: </strong><font class="important">*</font><input type="text" name="nik" value="<?php echo $nik; ?>" /><br/><br/>
 <strong>Name: </strong><font class="important">*</font><input type="text" name="firstname" value="<?php echo $firstname; ?>" /><br/><br/>
 <strong>Alamat: </strong><font class="important">*</font><input type="text" name="alamat" value="<?php echo $alamat; ?>" /><br/><br/>
 <strong>Company: </strong><font class="important">*</font><input type="text" name="lastname" value="<?php echo $lastname; ?>" /><br/><br/>
 <strong>Department: </strong><font class="important">*</font><input type="text" name="departemen" value="<?php echo $departemen; ?>" /><br/><br/>
 <strong>Telephone: </strong><font class="important">*</font><input type="text" name="telephone" value="<?php echo $telephone; ?>" /><br/><br/>
 <strong>Mobile: </strong><font class="important">*</font><input type="text" name="mobile" value="<?php echo $mobile; ?>" /><br/><br/>
 <strong>Email: </strong><font class="important">*</font><input type="text" name="email" value="<?php echo $email; ?>" /><br/><br/>
 <p><font class="important">*</font>required</p>
 <input type="submit" name="submit" value="Submit">
 </div>
 </form> 
 </body>
 </html>

Recommended Answers

All 8 Replies

What exactly do you want to do? Send this page to a processing page? If so, specify action="process.php" in your form tag.

yes, i want to process this into page of new_ticket.php i've try with this code :

if (isset($_POST['submit']))
 { 
 // confirm that the 'id' value is a valid integer before getting the form data
 if (is_numeric($_POST['id']))
 {
 // get form data, making sure it is valid
 $id = $_POST['id'];
 $nik = mysql_real_escape_string(htmlspecialchars($_POST['nik']));
 $firstname = mysql_real_escape_string(htmlspecialchars($_POST['firstname']));
 $alamat = mysql_real_escape_string(htmlspecialchars($_POST['alamat']));
 $lastname = mysql_real_escape_string(htmlspecialchars($_POST['lastname']));
 $departemen = mysql_real_escape_string(htmlspecialchars($_POST['departemen']));
 $telephone = mysql_real_escape_string(htmlspecialchars($_POST['telephone']));
 $mobile = mysql_real_escape_string(htmlspecialchars($_POST['mobile']));
 $email = mysql_real_escape_string(htmlspecialchars($_POST['email']));
  
 // check that firstname/lastname fields are both filled in
 if ($nik == '' || $firstname == '' || $alamat == ''|| $lastname == ''|| $departemen == ''|| $telephone == ''|| $mobile == ''|| $email == '')
 {
 // generate error message
 $error = 'ERROR: Please fill in all required fields!';
 
 //error, display form
 renderForm($id,$nik ,$firstname,$alamat, $lastname, $departemen, $telephone, $mobile, $email, $error);
 }
 else
 {
 // save the data to the database
 mysql_query("UPDATE contact SET nik='$nik', name='$firstname',alamat='$alamat', company='$lastname', departemen='$departemen', telephone='$telephone', mobile='$mobile',
									email='$email' WHERE id='$id'")
 or die(mysql_error()); 
 
 // once saved, redirect back to the view page
 header('Location: viewcontact.php');
 }
 }
 else
 {
 // if the 'id' isn't valid, display an error
 echo 'Error!';
 
 }
 }

but not works :( please help me.

change the action of your form and on process page, type

echo "<pre>";

print_r($_POST);
exit;

and share what you get

you mean like this :

<form action="<?php echo "<pre>";
					print_r($_POST);
					exit; ?>" method="post">

its not shows anything..

<form action="new_ticket.php" method="post">

no not like this :s
type this in your form

<form action='new_ticket.php' method='post'>

and then on new_ticket.php page
type this

echo "<pre>";
print_r($_POST);
exit;

and then submit your form and share what you get

sorry, i'm so confuse..

i've try and the result :

Array
(
)

what means this output? absolutely confused about this.
thanks advance baig :D

it means that your form is not posted on that page

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.