Jump to content

Can a form use ( is_numeric)or(is_string) ??


Phpfanboi

Recommended Posts

<FORM METHOD=POST ACTION="">
<p>Breeder or Business Name<br />
<input type = "text" name = "breedername" size= "25" maxlength = "50" />
</p>
<p>Breeder Telephone<br />
<input type = "text" name = "breedertelephone" size= "25" maxlength = "50" />
</p>
<p>Breeder Location<br />
<input type = "text" name = "breederlocation" size= "25" maxlength = "50" />
</p>
<p>Breeder Desription<br />
<input type = "text" name = "breederdescription" size= "25" maxlength = "50" />
</p>
<p>Leave blank<br />
<input type = "text" name = "breederverify" size= "5" maxlength = "5" /><br /><br />
</p>
<input type="submit" value="Submit" name='submit' />
<br />  <br />
</form>

 <?php
if (is_string($breederverify)) {                                                 <-- If $breederverify is set , then echo "Please leave the lowest box empty!"
echo "Please leave the lowest box empty!";
} else {                                                                     <-- else if $breederverify is unsigned/null execute this block.
$con = mysql_connect("localhost","xxxxxxxxxx","xxxxxxxxxx");

mysql_select_db("cichlid",$con);

$breedername = $_POST['breedername'];
$breedertelephone = $_POST['breedertelephone'];
$breederlocation = $_POST ['breederlocation'];
$breederdescription = $_POST ['breederdescription'];
$breederverify = $_POST ['breederverify'];

$sql = "INSERT INTO breedersinfo SET breederNAME = '$breedername' , breederTELEPHONE = '$breedertelephone' , breederLOCATION = '$breederlocation' , breederDESCRIPTION =                '$breederdescription'";

if(!mysql_query($sql,$con))
{
die('ERROR:Could not connect ' . mysql_error ());
}
echo "";
	  
mysql_close ($con) ;


}

?>

 

 

 

 

 

 

 

 

 

All i am trying to accomplish is a form field that will only update records if the last

$breederverify = $_POST ['breederverify'];

is null/unasigned . I was thinking in order to do this i could use is_numeric , or is_string function to check $var ,to see what it's state is. Any help or advice would be appreciated , provided this is even possible. Cheers guys . :confused:

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.