Jump to content
php.lv forumi

dabuut info un links uz citu lapu


illegal

Recommended Posts

<html>

<body bgcolor="99ccff">

<center>

 

 

</center>

<form action="index.php" method=POST>

Kas noticis ?: <input type=text name=user> <br/>

Kura vieta ?: <input type=text name=user2> <br/>

<input type=submit value="Pievienot/Atjauninat"><p>

</form>

 

<?php

 

 

$user=$_POST['user'];

$user2=$_POST['user2'];

 

 

 

 

 

echo "<br />";

$file=fopen("tests.txt","a+") ;

 

 

fwrite($file,"<br>Kas: ");

fwrite($file,$user);

fwrite($file,"<br/>Kur: ");

fwrite($file,$user2);

 

fclose ($file);

?>

 

</body>

</html>

 

 

Sveiki....

Man liekas ka tas ir ljoti vienkaarshi, bet google kaut kaa nesanaak sameklet :(

 

ka lai uz pogas "Pievienot/Atjauninat" uzliek taa, ka iegust informaciju no laukiem user un user2 un tai pashaa laikaa aiziet uz citu lapu...

 

Bushu pateicigs, ja kads vareetu izskaidrot :)

Link to comment
Share on other sites

Aizsūta uz citu lapu ar

header('Location: http://www.tavalapa.ta/citalapa.php');

Tavā kodā gan ir jāveic nelielas izmaiņas, jo header drīkst sūtīt tikai pirms ir sākusies jebkāda veida izvade:

<?php
if(array_key_exists('user',$_POST) && array_key_exists('user2', $_POST)){
$user=$_POST['user'];
$user2=$_POST['user2'];
$file=fopen("tests.txt","a+");
fwrite($file,"<br>Kas: ");
fwrite($file,$user);
fwrite($file,"<br/>Kur: ");
fwrite($file,$user2);
fclose ($file);
header('Location: http://citaslapasadrese');
}
else{
echo "<html>
<body bgcolor='99ccff'>
<center>
</center>
<form action='index.php' method=POST>
Kas noticis ?: <input type=text name=user> <br/>
Kura vieta ?: <input type=text name=user2> <br/>
<input type=submit value='Pievienot/Atjauninat'><p>
</form>
</body>
</html>";
}
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...