Jump to content

<form action= > problem


robert_gsfame

Recommended Posts

if((!empty($_POST['title'])) && (!empty($_POST['text']))){

$check="success.php";}else{

$check="failed.php";}?>

 

<form method = "post" action="<?php echo $check;?>">

 

Which part is wrong as i always go to failed.php although both text and title are not empty

 

i've tried with !isset but it didn't work either...need someone suggestion..

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/172965-problem/
Share on other sites

Try this:

 

Make a new file called action.php and in it place the following code:

 

<?php
if((!empty($_POST['title'])) && (!empty($_POST['text']))){
      INSERT INTO HERE WHATEVER IS IN success.php (excluding <?php and ?>) ;
} else {
      INSERT INTO HERE WHATEVER IS IN failed.php (excluding <?php and ?>) ;
}
?>

 

Change the code on the form to this:

 

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

 

Maybe you should try that :)

Link to comment
https://forums.phpfreaks.com/topic/172965-problem/#findComment-911908
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.