Jump to content

please help doing my head in


Danny620

Recommended Posts

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\send.php on line 37

 

<?php require('config.php'); ?>

<?php	

if(isset($_POST[send])){

		$x = array();

	$user = htmlentities($_POST[user]);
	$message = htmlentities($_POST[message]);

	$user = mysqli_real_escape_string($dbc,$user);
	$message = mysqli_real_escape_string($dbc,$message);

	$countmessage = strlen ($message);

	if($countmessage <= 2){ $x = 'Message Must be greater than 2 letters'; }

	$q = "SELECT username FROM test WHERE username='$user'";
			$r = mysqli_query($dbc,$q);
			$usercheck = mysqli_num_rows($r);

			if($usercheck != 1){ $x = 'The user does not exist'; }

	}

	?>
<link href="battle Eara/css/testting.css" rel="stylesheet" type="text/css">
<form id="form1" name="form1" method="post" action="">
  <table width="379" border="0" align="center" class="table_bottom">
    <tr class="top_table">
      <td colspan="2"><span class="style1">Create Message</span></td>
    </tr>
    <tr>
      <td width="95" height="47"> </td>
      <td width="229"><div align="center">
        <?php foreach($x as $msg){ echo " - $msg<br />"; } ?>
      </div> </td>
    </tr>
    <tr>
      <td><div align="center" class="style3">To:</div></td>
      <td><label>
        <input name="user" type="text" class="textfield" id="user" maxlength="20" />
      </label></td>
    </tr>
    <tr>
      <td height="106"><div align="center" class="style3">Message:</div></td>
      <td><label>
        <textarea name="message" cols="45" rows="5" class="textfield" id="message"></textarea>
      </label></td>
    </tr>
    <tr>
      <td height="33"> </td>
      <td><label>
        <div align="center">
          <input name="send" type="submit" class="textfield" id="send" value="Send" />
        </div>
      </label></td>
    </tr>
    <tr>
      <td height="33">Testing Zone</td>
      <td> </td>
    </tr>
  </table>
</form>

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.