0

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>
3
Contributors
8
Replies
12
Views
5 Years
Discussion Span
Last Post by baig772
0

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

0

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.

0

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

echo "<pre>";

print_r($_POST);
exit;

and share what you get

0

you mean like this :

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

its not shows anything..

0

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

0

sorry, i'm so confuse..

i've try and the result :

Array
(
)

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.