Jump to content

Need some help...


unknown

Recommended Posts

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
Share on other sites

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
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.