Current location: Hot Scripts Forums » Programming Languages » PHP » form question


form question

Reply
  #1 (permalink)  
Old 01-16-04, 06:16 PM
delerium's Avatar
delerium delerium is offline
Newbie Coder
 
Join Date: Jan 2004
Location: pittsburgh
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
form question

ok, heres my script:
$result = mysql_query("SELECT * FROM orderrequestform",$db) ;printf(mysql_error());
if ($myrow = mysql_fetch_array($result))
{

echo "<table cellpadding=0 cellspacing=0 border=1>\n";
printf("<tr><td><a>check box form under here</a><br></td>

<td><a>first name</a><br></td>
<td><a>last name</a><br></td>
<td><a>school</a><br></td>
<td><a>Street Address</a><br></td>
<td><a>City</a><br></td>
<td><a>State</a><br></td>
<td><a>Zip</a><br></td>
<td><a>Phone Number</a><br></td>
<td><a>Email Address</a><br></td>

</tr>\n",
$PHP_SELF, $myrow["FName"],$PHP_SELF, $myrow["LName"],
$PHP_SELF, $myrow["School"],$PHP_SELF, $myrow["SAddress"],
$PHP_SELF, $myrow["City"],$PHP_SELF, $myrow["State"],
$PHP_SELF, $myrow["Zip"],$PHP_SELF, $myrow["PhoneNum"],
$PHP_SELF, $myrow["Email"]);
do {
//this populates the table
printf("<tr><td>i want a check box here</td><td>%s</td><td>%s</td>
<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</tr>\n",
$myrow["FName"],
$myrow["LName"],$myrow["School"], $myrow["SAddress"] ,$myrow["City"]
, $myrow["State"], $myrow["Zip"], $myrow["PhoneNum"], $myrow["Email"]);

} while ($myrow = mysql_fetch_array($result));


as you can see, what im doing is creating a table that will be filled with everything in my data base. simple enough i guess. what i need to do now is have a check box form included with each row of the table (i marked the space in the table). problem is, when i try to include the form i get errors saying unexpected T-String. the code i have in the cell space is "<input type="checkbox" name="a" value="a">" any suggestions on what im doing wrong and what i could do to fix it?
Reply With Quote
  #2 (permalink)  
Old 01-17-04, 09:29 AM
HasansWeb HasansWeb is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Well I don't see a form, it would help if you copy and paste the exact code if you cut it out.

Anyways, try putting your myrow arrays inside the curly brackets. so instead of $myrow['FName'], put {$myrow['FName']}
Reply With Quote
  #3 (permalink)  
Old 01-17-04, 10:39 AM
Aaronn's Avatar
Aaronn Aaronn is offline
Newbie Coder
 
Join Date: Nov 2003
Location: Spokane Washington
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by delerium
ok, heres my script:
$result = mysql_query("SELECT * FROM orderrequestform",$db) ;printf(mysql_error());
if ($myrow = mysql_fetch_array($result))
{

echo "<table cellpadding=0 cellspacing=0 border=1>\n";
printf("<tr><td><a>check box form under here</a><br></td>

<td><a>first name</a><br></td>
<td><a>last name</a><br></td>
<td><a>school</a><br></td>
<td><a>Street Address</a><br></td>
<td><a>City</a><br></td>
<td><a>State</a><br></td>
<td><a>Zip</a><br></td>
<td><a>Phone Number</a><br></td>
<td><a>Email Address</a><br></td>

</tr>\n",
$PHP_SELF, $myrow["FName"],$PHP_SELF, $myrow["LName"],
$PHP_SELF, $myrow["School"],$PHP_SELF, $myrow["SAddress"],
$PHP_SELF, $myrow["City"],$PHP_SELF, $myrow["State"],
$PHP_SELF, $myrow["Zip"],$PHP_SELF, $myrow["PhoneNum"],
$PHP_SELF, $myrow["Email"]);
do {
//this populates the table
printf("<tr><td>i want a check box here</td><td>%s</td><td>%s</td>
<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</tr>\n",
$myrow["FName"],
$myrow["LName"],$myrow["School"], $myrow["SAddress"] ,$myrow["City"]
, $myrow["State"], $myrow["Zip"], $myrow["PhoneNum"], $myrow["Email"]);

} while ($myrow = mysql_fetch_array($result));


as you can see, what im doing is creating a table that will be filled with everything in my data base. simple enough i guess. what i need to do now is have a check box form included with each row of the table (i marked the space in the table). problem is, when i try to include the form i get errors saying unexpected T-String. the code i have in the cell space is "<input type="checkbox" name="a" value="a">" any suggestions on what im doing wrong and what i could do to fix it?

I'm no PHP expert but what I did in this same kinda setup is:
<?
//put all html into a php variable

$table_code="<p align=\"center\"><img src=\"images/braggdisclogo1.gif\" width=\"540\" height=\"150\"><br><p align=\"center\"><font size=\"2\"><b>Bragg Clients</b>\n<br>".date("F d, Y")."</font></p>\n
<table width=\"749\" border=\"1\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">\n
<tr>\n
<td width=\"69\"><input type=\"submit\" name=\"Submit\" value=\"Query\"></td>\n
<td width=\"126\"><input type=\"radio\" name=\"client_query\" value=\"4\">Order By Date</td>\n
<td width=\"205\"><input type=\"radio\" name=\"client_query\" value=\"3\">Alphabetical By Last Name</td>\n
<td width=\"143\"><input type=\"radio\" name=\"client_query\" value=\"5\"> View Downlines</td>\n
<td width=\"143\"><input type=\"radio\" name=\"client_query\" value=\"1\"> Query All Clients</td>\n
</tr>\n";


echo"$table_code";
while ($row=mysql_fetch_array($result))
{
echo "<font size=\"2\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;</font>";
echo "<table width=\"749\" border=\"1\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">\n";
echo "<tr align=\"center\" valign=\"top\" bgcolor=\"#C7D1E6\">\n";
echo " <td width=\"46\"><font size=\"2\"><b><input type=\"checkbox\" name=\"delete_box\" value=",($row['id']),"><br>delete?</font></b></td>\n";
echo " <td width=\"78\"><font size=\"2\">First Name:&nbsp<br><b>".($row['first_name'])."</font></b></td>\n";
echo " <td width=\"75\"><font size=\"2\">Last Name:&nbsp<br><b>".($row['last_name'])."</font></b></td>\n";
echo " <td width=\"233\"><font size=\"2\" color=\"#000000\">Email:&nbsp<br><b><a href=\"mailto:".($row['email'])."\">".($row['email'])." </a> </font></b></td>\n";

echo " <td width=\"64\"><font size=\"2\">Phone:&nbsp<br><b>".($row['phone'])."</font></b></td>\n";
echo " <td width=\"65\"><font size=\"2\">Product:&nbsp<br><b>".($row['product'])."</font></b></td>\n";
echo " <td width=\"94\"><font size=\"2\">Access Code:<br>&nbsp<b>".($row['access_code'])."</font></b></td>\n";
echo " <td width=\"60\"><font size=\"2\">Date:&nbsp<br><b>".($row['date'])."</font></b></td>\n";
echo "</tr>\n";

}

?>
That will put a check box at the end of every row, and the row id will be it's value.

Let me know if that help at all.
Reply With Quote
  #4 (permalink)  
Old 01-17-04, 04:59 PM
Pineapple Pineapple is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Phoenix, AZ
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
You need to escape the quotes, you can't have quotes within quotes since PHP doesn't know where your string ends:

"<input type=\"checkbox\" name=\"a\" value=\"a\">"
__________________

Pineapple Technologies :: http://www.pineappletechnologies.com

Lore - a powerful knowledge base management system which uses PHP, MySQL, and Smarty templates.

QuizShock - an advanced quiz management system using PHP, MySQL, and Flash.
Reply With Quote
  #5 (permalink)  
Old 01-19-04, 05:01 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
Im just guessing now.. no pro my self.. but maby if you try putting single inside the double... like this: "<input type=\'checkbox\' name=\'a\' value=\'a\'>"

glad to help if it helps
Wille
Reply With Quote
  #6 (permalink)  
Old 01-19-04, 10:30 PM
robee's Avatar
robee robee is offline
New Member
 
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
oopsss, wrong thread...sorry

Last edited by robee; 01-19-04 at 10:42 PM.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
formmail problem gscraper Perl 12 08-27-04 03:06 AM
submit form? tcooper PHP 5 12-12-03 03:30 PM
question on form and submit TxRanger JavaScript 2 11-03-03 11:28 AM
SQL database registration form help vinhkhuong PHP 3 10-10-03 03:49 AM
asp: URGENT! need to change code to create new form per id seala ASP 2 09-09-03 09:54 PM


All times are GMT -5. The time now is 08:31 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.