Currently the script below works if the user does not type a name/message, but if i create a whitespace with the spacebar, it will submit. How would I fix this?
message page:
<?php
// Get the file
$file = implode('', file ("post.xml"));
print "
<form action=post.php method=post>
<input type=hidden name=post value=yes>
<p>
Your Name
<input type=text name=name size=30>
</p>
<p>
Message
<textarea name=message rows=5 cols=50></textarea>
</p>
<p>
<input type=submit value="Post">
<input type=reset value=Reset>
</p>
</form>";
?>
action page:
<?php
$name=$_POST['name'];
$message=$_POST['message'];
// Name and Message required
if (( $name == "") || ( $message == "")) {
print "<p align=center>Please go back to complete all fields!<p>";
}
else {
//Get the file
$file_name = "post.xml";
$file_pointer = fopen($file_name, "r+");
$lock = flock($file_pointer, LOCK_EX);
$file_read = fread($file_pointer, filesize($file_name));
//$name = strip_tags($name, '');
//$message = strip_tags($message, '');
$date = date ("j M Y");
$post = "nn<ponmurt>n<p><span class=name>$name</span><span class=date> $date</span>
$message</p>n</ponmurt>";
//Paste the updated info into the file
$post = stripslashes($post);
fwrite($file_pointer, "$post");
fclose($file_pointer);
print "<head><meta http-equiv=refresh content=0;URL=index.php></head>";
}
?>
compile php5 with DOM
Hi,I can't manage to compile php 5.3.0 from source on Windows to include DOM,in spite of the documentation saying that DOM is built into PHP5.I'm compiling php 5.3.0 using the following minimalistic
mysql VARCHAR acting like INT
Hi, All.I have a table that contains a varchar(10) column named weird_field. In this column, only integers reside (e.g., 3010101009). When I do this:Line number On/Off | Expand/Contract select *
text box alphanumeric caracters only
hi all! I have search on google on how to enter in a test box only caracters A-Z,a-z,0-9 using php, but all the solutions are not for me I need, if you can help me to allow a user to insert only those
Page Reload
I am having issues getting a page to reload after I submit data to a database. This form should input data to a DB and then I want it to reload and list what is in database. I have gotten it to
'210010106140040100' == '210010106140040101'
Debugging this simple line of a PHP scriptCode: if($a == $b){ } I've found that with value of$a = '210010106140040100' (type = string)$b = '210010106140040101' (type = string)the result of the
HTML Email rec'd as Source Code
The code does create and send the email successfully. However, the message shows as html code and not an html email. Any ideas what is causing this?Thanks.Code: // Email require_once
How do I use ValidatorCallout extender in Login control?
Hi,I'd like to customize the look and feel of the login control a little bit. One thing I'd love to do is to use the ValidatorCallout extender in AJAX controls toolkit so that I can display nicer
PHP - HTML
Could anyone give me some GOOD sample links for php - html email tutorial.Thanks!
Set Categories
I am creating a submission form for somebody to come in and submit products. These products are separated by brand. How can I get them to display according to the brand?Here is the form code:Code:
str_replace help
Hey there,I'm a PHP newb, I'm having troubles with the str_replace function. I want to clean up bad html to valid xhtml, I am using:Code: $pee = str_replace('&', '&amp;', $pee);It