Jump to content

Testing to see if a string ends in .gif


jimmyelewis

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.
Link to comment
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.
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.