i posted on this earlier and with forum help get my function code to work as I want when I test it.
But when I insert it into the php document I only get errors.
The function is:
<?php
function fix_it($name)
{
$name=ucwords(strtolower($name));
echo $name;
}
?>
The document form:
<?php //query to select all
if (isset($_POST['name'])) $name = $_POST ['name'];
else $name = "(Not entered)";
echo <<<_END
<html>
<body>
<form method="post" action="allaunch_2.php">
Enter Ship Name
<input type="text" name="name" size="25" maxlength ="35"/>
<input type="image" name="submit" src="newindex_files/cooltext497898955.png" onmouseover="this.src='images/cooltext497898955MouseOver.png';" onmouseout="this.src='images/cooltext497898955.png';" alt="search"/>
</form>
</body>
</html>
_END;
if($name == "")
{
echo "<p><font color='red' size='4px'>You have not entered a name</font></p>";
exit;
}
else
{
echo "<p><font color='blue' size='4px'>You searched for:</font></p>";
echo "<p><font color='blue' size='6px'>$name</font></p>";
}
require_once "dbconnect.php";
require_once "fix_it.php";
echo fix_it($name);
//query and table follow
The output is:
Enter Ship Name
You searched for:
miami // as input & displays in blue
( ! ) Fatal error: Call to undefined function fix_it() in C:\wamp\www\WSRU\allaunch_2.php on line 26
Call Stack
# Time Memory Function Location
1 0.0007 394160 {main}( ) ..\allaunch_2.php:0
Sorry to make it so long.
Where do I place the function call ?