Jump to content

Archived

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

jimmyelewis

Testing to see if a string ends in .gif

Recommended Posts

Hey,

I have the following code
[code]
if (mysql_query ($query)) {
    echo 'The tool has been added.';
    } else {
    echo '<p>Could not add the tool because <b>' . mysql_error() . '</b>.  The query was ' .$query . '.</p>';
    }
    mysql_close();
}
// Display form
?>

<form action="index.php" method="post">
<p>Tool Name: <input type="text" name="tool_name" size="40" maxsize="50" /></p>
<p>Tool Icon Name: <input type="text" name="tool_icon" size="40" maxsize="50" /></p>
<p>Tool Link: <input type="text" name="tool_link" size="40" maxsize="150" /></p>
<p>Tool Category:
    <select name="tool_cat">
    <option value="Inventory">Inventory</option>
    <option value="Network Tools">Network Tools</option>
    <option value="Reference">Reference</option>
    <option value="User Account Tools">User Account Tools</option>
    <option value="Web Tools">Web Tools</option>
    </select></p>
<input type="submit" name="submit" value="Add Tool" />
</form>
[/code]

If I wanted to check to see that tool_icon ends with .gif how would I do that and if it doesn't end in .gif where would I echo to the use to please end tool icon name with .gif.

Share this post


Link to post
Share on other sites
you want to check BEFORE the form is submited corect??

Share this post


Link to post
Share on other sites
[!--quoteo(post=357781:date=Mar 23 2006, 05:23 PM:name=craygo)--][div class=\'quotetop\']QUOTE(craygo @ Mar 23 2006, 05:23 PM) [snapback]357781[/snapback][/div][div class=\'quotemain\'][!--quotec--]
you want to check BEFORE the form is submited corect??
[/quote]

Yes, because it adds the icon name to a mysql database.

Share this post


Link to post
Share on other sites

×

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.