Jump to content

stuck please help me


ali_2kool2002

Recommended Posts

Hi me agen,, sorry to trouble u but i stil cant get the input boxes validated to see if they are filled in...

as shown below im using a loop,, the value in the loop $aa is coming from the database which works fine and can be random numbers

 

however using the array for the input boxes in the loop as you have suggested doesnt seem to check  properly,,, as its run on my localhost,, the output keeps sayin "////not empty --fine" when the user has left the input box  empty,, can sum1 please help cuz iv been tryin this for 4hours...n my necks kiling now lol  ??? ???

 

 

 

 

for ($i = 0; $i < $aa; $i++) {

echo "<td align=\"left\"><input type=\"text\" name=txtbox[]>";

echo "<td align =\"left\"><input type=\"submit\" name=\"sub_{$i}\" value=\"Add to cart\" /><br />";
echo" <input type=\"hidden\" name=\"submitted\" value=".$i." />";

}


 

 

 

 


<?php
session_start();
$PHPSESSID = session_id(); 

require_once('mysql_connect.php');

if  (isset($_POST['submitted'])) {

if (! empty ($_POST['txtbox'])){
echo "////not empty --fine";
}
else{
echo "empty please enter data in input text box";
}




}
?>


 

 

Link to comment
https://forums.phpfreaks.com/topic/39061-stuck-please-help-me/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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