•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,821 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,625 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 897 | Replies: 2
![]() |
•
•
Join Date: Mar 2008
Posts: 42
Reputation:
Rep Power: 1
Solved Threads: 0
Hello im new to the world of php, ive been designing a webpage in ma spare time and ive got to a stage where im stuck its basically ticking checkboxes and inserting them into the next page somehow using the $post method not sure how to do it. But the problem i have is the options i want to chose are searched from a database and i want to select an output and then send it to the next page using a submit button. Form Submit array, ive got no idea at all ive done some coding up to adding checkboxes next to each row. heres my coding so far. Also i dont think you can have form in the php section;
•
•
•
•
<?
<form name="Dates" action=".php" method="post" onsubmit="return checkCheckBoxe();">
// Loop through data and display
while($a_row = mysql_fetch_assoc($result))
{
echo "<tr>".
'<td style="color: red;"><input type="checkbox" name="bookings[]" value="'.$a_row['id'].'"></td>'.
"<td style=\"color:red\">".$a_row['TIME']."</td>".
"<td style=\"color:red\">".$a_row['MONTH']."</td>".
"<td style=\"color:red\">".$a_row['YEAR']."</td>".
"<td style=\"color:red\">".$a_row['DAY']."</td>".
"<td style=\"color:red\">".$a_row['PERSON']."</td>".
"<td style=\"color:red\">".$a_row['SYSTEM']."</td>".
"<td style=\"color:red\">".$a_row['EBAYER']."</td>".
"<td style=\"color:red\">".$a_row['AGE']."</td></tr>";
}
// Close connection ! (please !)
mysql_close($connection);
<input type="submit" name="Submit" value="Submit!" />
</form>
?>
first, no, you cant have any html inside of the php tags unless it is in an echo/print . i would put the form and submit buttom outside of the tags.
second, before you try to loop through databaase results, you have to connect to the database and retrieve results.
example:
and also, the "onsubmit" attribute of the html form tag does not relate to php. that is only if you are submiting the form with javascript.
hope this helps
second, before you try to loop through databaase results, you have to connect to the database and retrieve results.
example:
php Syntax (Toggle Plain Text)
mysql_connect($dbhost, $dbuser, $dbpasswd) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $sql = "SELECT * FROM your_db_table"; $result = mysql_query($sql);
and also, the "onsubmit" attribute of the html form tag does not relate to php. that is only if you are submiting the form with javascript.
hope this helps
Last edited by peter_budo : Apr 1st, 2008 at 6:06 am. Reason: Keep It Organized - please use [code] tags
toast
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
•
•
•
•
<form name="Dates" action=".php" method="post" onsubmit="return checkCheckBoxe();">
action=".php" should be action="filename.php".
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Other Threads in the PHP Forum
- Previous Thread: PHP version of Java's instanceof
- Next Thread: mysql_fetch_row(): supplied argument is not a valid MySQL result resource



Linear Mode