nova_joseph2000 Posted May 6, 2007 Share Posted May 6, 2007 php: <?php if($_POST['submit'] == 'Submit') { if(!$_POST['email'] ||$_POST['email'] == "" || strlen($_POST['email'] >30 )) { $message = '<p> There is a Problem .Did you enter an email address ?</p>'; } else { //Open connection to the database mysql_connect("localhost","root","") or die ("Failure to communicate with database"); mysql_select_db("test"); //Insert email adresses $as_email = addslashes($_POST['email']); $tr_email = trim($as_email); $query ="INSERT INTO test4040 (ID,Email,Source) VALUES(NULL,'$tr_emial',www.example.com')"; $result = mysql_query($query); if(mysql_affected_rows() == 1) { $message ='<p>Your record has been recorded.</p>'; $noform_var = 1; } else { error_log(mysql_error()); $message = '<p>Your information has been wrong eith your sing up attempt.</p>'; } } //Show The form in every cae except successful submission if (!noform_var) { $thisfile =$_SERVER['PHP_SELF']; $message = <<< EOMSG <p>Enter your email in every address and we will send you our weekly newsletter .</p> <form method="post" action="$thisfile"> <br /><br /> <input type="submit" value="Submit" /> </form> EOMSG; } } ?> <html> <head> <style type="text/css"> <!-- body,p {color:#000000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} --> </style> </head> <body> <table border="0" cellpadding="10" width="100%"> <tr> <td bgcolor="#fof8ff" align="center" valign="top" width="17%"> </td> <td bgcolor="#ffffff" align="left" valign="top" width="83%"> <h1>Newsletter sing up form</h1> <?php echo $message; ?> </td> </tr> </table> </body> </html> I was executed in the the above programe the result page is xecuted only <html> <head> <style type="text/css"> <!-- body,p {color:#000000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;} --> </style> </head> <body> <table border="0" cellpadding="10" width="100%"> <tr> <td bgcolor="#fof8ff" align="center" valign="top" width="17%"> </td> <td bgcolor="#ffffff" align="left" valign="top" width="83%"> <h1>Newsletter sing up form</h1> <?php echo $message; ?> </td> </tr> </table> </body> </html> Link to comment https://forums.phpfreaks.com/topic/50199-problem-with-_serverphp_self/ Share on other sites More sharing options...
hackerkts Posted May 6, 2007 Share Posted May 6, 2007 Replace if($_POST['submit'] == 'Submit') with if(isset($_POST['submit'])) Replace <input type="submit" value="Submit" /> with <input type="submit" value="Submit" name="submit" /> Link to comment https://forums.phpfreaks.com/topic/50199-problem-with-_serverphp_self/#findComment-246445 Share on other sites More sharing options...
nova_joseph2000 Posted May 6, 2007 Author Share Posted May 6, 2007 my problem is not working <?php echo $message; ?> Link to comment https://forums.phpfreaks.com/topic/50199-problem-with-_serverphp_self/#findComment-246495 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.