Jump to content

Comment submit form.


Makeshift67

Recommended Posts

hey guys. i recently put a PHP comment submit form on my site, and it works fine.

 

the only problem is when it goes to the page that saves and posts the provided information, if they just type in the URL, it will post a blank form.

 

 

also, i am also looking to make the form error if not all fields are filled out.

 

thanks for any help.

Link to comment
Share on other sites

Okay, so it posts a blank form. Are we to assume you want to prevent that...

 

As for making the form to error if all fields aren't filled out, use some if blocks for that.

 

if (!isset($_POST['FOO']) or strlen($_POST['FOO']) < 1) {
echo "<h2>Please fill in all fields.</h2>"; die();
}

 

Link to comment
Share on other sites

 

here a nice way to validate code.

<?php

$array=array("name"=>"redarrow","password"=>"1234","email"=>"redarrow@hotmail.co");


if(strlen($array['name'])>3){

$war[]="Sorry name to long!";
}
if(strlen($array['password']>1)){
$war[]="Sorry password to small";
}
if(strlen($array['email'])>1){
$war[]="Sorry email to big";
}

foreach($war as $result){

echo "$result<br>";
}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • 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.