unknown Posted October 20, 2007 Share Posted October 20, 2007 Hello!, I want to make these 3 fileds (keyword filed, link filed and title field) required, but my logo to not disappear form my page. <?php if(isset($_POST['link'])){ //clean link $keyword_list = explode(' ',mysql_escape_string($_POST['keyword'])); $link = mysql_escape_string($_POST['link']); $title = mysql_escape_string($_POST['title']); $desc = mysql_escape_string($_POST['description']); include('dbcreds.php'); foreach ( $keyword_list as $k => $v ){ $sql = 'INSERT INTO `search_data` VALUES (NULL,"'.$v.'","'.$title.'","'.$link.'","'.$desc.'",0,CURRENT_TIMESTAMP(),0,0)'; mysql_query($sql); } echo '<b>Link successfully stored.</b>'; } ?> <title>PcFile - Add a link</title> <div align="center"><a href="./"><img src="images/logo.jpg" alt="placeholder logo" width="201" height="152" border="0"/></a></div> <form action="" method="POST"> <table align="center"> <tr> <td>Keyword </td> <td><input type="text" name="keyword"></td> <td><div align="left"><span style="font-size:10pt">Add a keyword [ex:. keyword1 keyword2 keyword 3] </span></div></td> </tr> <tr> <td>Titel</td> <td><input type="text" name="title"></td> <td><div align="left"><span style="font-size:10pt">The title of the link (under 200)</span></div></td> <tr> <td>Link</td> <td><input type="text" name="link"></td> <td><div align="left">ex: http://mysite.com/file.zip </div></td> </tr> <tr> <td>Description</td> <td><textarea name="description"></textarea></td> <td><div align="center"></div></td> </tr> <tr> <td colspan=2 align="center"><input type="submit" value="Add"></td> <td><div align="center"></div></td> </tr> </table> <blockquote> <blockquote> <p align="center"><a href="search.php">Back</a></p> </blockquote> </blockquote> </form> Thank you very much! Link to comment https://forums.phpfreaks.com/topic/74067-need-some-help/ Share on other sites More sharing options...
ignace Posted October 20, 2007 Share Posted October 20, 2007 you are gonna need to provide some more info, as i have no clue what your problem is Link to comment https://forums.phpfreaks.com/topic/74067-need-some-help/#findComment-373919 Share on other sites More sharing options...
unknown Posted October 20, 2007 Author Share Posted October 20, 2007 Hello!, The problem is that I can submit without filling any field. And my mysql database will be filled with empty fileds. I want to make keyword filed, link field and title filed required. When I will press the Add buttom to announce me that i haven`t filled these fileds (if the fields were empty). Thank you! Link to comment https://forums.phpfreaks.com/topic/74067-need-some-help/#findComment-373929 Share on other sites More sharing options...
Ninjakreborn Posted October 20, 2007 Share Posted October 20, 2007 I know what you are wanting, however you need to learn a little more before starting to get into programming. You are speaking of needing basic validation and a basic db call. Link to comment https://forums.phpfreaks.com/topic/74067-need-some-help/#findComment-373964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.