<html>
<head>
</head>
<body>
<?php
$days_array = array("");
for($_GET['days'] as $val2)
{	
$days_array[] = $val2;
echo $days_array[0]; 
}
?>
<form name="fors" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
Enter text:<input type="text" name="days">
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

get the text box value using array and display the value using array.

Member Avatar for amigura
<html>
<head>
</head>
<body>
<?php
$days_array = explode(',',$_POST['days']); // turn post into array
foreach($days_array as $v)
{	
echo $v.'<br />'; // display array
}
?>
sperate dates with a comma<br />
<form name="fors" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
Enter text:<input type="text" name="days"> <input type="submit" name="submit" value="submit">
</form>
</body>
</html>

Not that much perfect coding solution

<html>
<head>
</head>
<body>
<?php
$days_array = explode(',',$_POST['days']); // turn post into array
foreach($days_array as $v)
{	
echo $v.'<br />'; // display array
}
?>
sperate dates with a comma<br />
<form name="fors" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
Enter text:<input type="text" name="days"> <input type="submit" name="submit" value="submit">
</form>
</body>
</html>

Not that much perfect coding solution

It is so easy to critize somebody's else work. So why don't you explain what is wrong with the proposed code and provide your solution to compare?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.