-
Posts
907 -
Joined
-
Last visited
Everything posted by searls03
-
OK I am pretty sure that is the relevant code........
-
help?
-
did that make sense?
-
so I have this code: <?php //Search 'events' table for the username //I don't know where you're storing username, but I've assumed It's defined as $username $sql = mysql_query("SELECT * FROM Events WHERE eventid=".$_GET['eventid']." LIMIT 1"); while($row = mysql_fetch_array($sql)){ $title11 = $row['title1']; $title21 = $row['title2']; $title31 = $row['title3']; $title41 = $row['title4']; $title51 = $row['title5']; $title61 = $row['title6']; $title71 = $row['title7']; $title81 = $row['title8']; } ?> <?php $sql = mysql_query("SELECT * FROM Registration WHERE eventid=".$_GET['eventid']." LIMIT 1"); while($row = mysql_fetch_array($sql)){ $eventid = $row["eventid"]; $event = $row["event"]; $startdate = $row["startdate"]; $enddate = $row["enddate"]; $description = $row["description"]; $location = $row["location"]; $title1 = $row['title1']; $title2 = $row['title2']; $title3 = $row['title3']; $title4 = $row['title4']; $title5 = $row['title5']; $title6 = $row['title6']; $title7 = $row['title7']; $title8 = $row['title8']; $price1 = $row['price1']; $price2 = $row['price2']; $price3 = $row['price3']; $price4 = $row['price4']; $price5 = $row['price5']; $price6 = $row['price6']; $price7 = $row['price7']; $price8 = $row['price8']; $date1 = $row['date1']; $date2 = $row['date2']; $date3 = $row['date3']; $date4 = $row['date4']; $date5 = $row['date5']; $date6 = $row['date6']; $date7 = $row['date7']; $date8 = $row['date8']; //this will echo the contents of each db row as they are iterated in the loop ############################# echo "<form action ='eventreg.php' method='post'>"; echo "<center><table border='1' width='600'>"; // Example of testing title1 for the userid (already registered) ... if (!empty($title11)){ echo "<tr><td width='300'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> "; } else{ if (!empty($title1)) { echo "<tr><td width='300'> <input type='checkbox' name='title1' value='$title1'/></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> "; } } if (!empty($title21)){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title2)) { echo "<br/><tr><td> <input type='checkbox' name='title2' value='$title2' /></td><td><strong>$title2 </strong><br /> $date2 <br />$ $price2 </tr></td>" ; } if (!empty($title31)){echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title3)) { echo "<br/><tr><td><input type='checkbox' name='title3' value='$title3' /></td><td><strong>$title3</strong> <br /> $date3 <br />$ $price3</tr></td>"; } if (!empty($title41)){ echo "<tr><td width='100'><strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title4)) { echo "<br/><tr><td><input type='checkbox' name='title4' value='$title4' /></td><td><strong>$title4</strong> <br /> $date4 <br />$ $price4</tr></td>"; } if (!empty($title51)){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title5)) { echo "<br/><tr><td><input type='checkbox' name='title5' value='$title5' /></td><td><strong>$title5</strong> <br /> $date5 <br />$ $price5</tr>"; } if (!empty($title61)){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title6)) { echo "<br/><tr><td> <input type='checkbox' name='title6' value='$title6' /></td><td><strong>$title6 </strong><br /> $date6 <br />$ $price6</tr></td>"; } if (!empty($title71)){echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title7)) { echo "<br/><tr><td> <input type='checkbox' name='title7' value='$title7' /></td><td><strong>$title7</strong> <br /> $date7 <br />$ $price7</tr></td>"; } if (!empty($title81)){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title8)) { echo "<br/><tr><td> <input type='checkbox' name='title8' value='$title8' /></td><td><strong>$title8</strong> <br /> $date8 <br />$ $price8</tr></td>"; } echo "</table>"; echo "<input name='userid' type=\"hidden\" value=\"$userid\" />"; echo "<input name='eventid' type=\"hidden\" value=\"$eventid\" />"; echo "<input name='email' type=\"text\" value=\"$email\" />"; echo "<input name='event' type=\"hidden\" value=\"$event\" />"; echo "<input name='name' type=\"hidden\" value=\"$name\" />"; echo "<input name=\"save\" type=\"submit\" value=\"Register Now!\" />"; echo "<input name='price1' type=\"hidden\" value=\"$price1\" />"; echo "<input name='price2' type=\"hidden\" value=\"$price2\" />"; echo "<input name='price3' type=\"hidden\" value=\"$price3\" />"; echo "<input name='price4' type=\"hidden\" value=\"$price4\" />"; echo "<input name='price5' type=\"hidden\" value=\"$price5\" />"; echo "<input name='price6' type=\"hidden\" value=\"$price6\" />"; echo "<input name='price7' type=\"hidden\" value=\"$price7\" />"; echo "<input name='price8' type=\"hidden\" value=\"$price8\" />"; echo "</center></form>"; } //etc etc //If it finds a match, output an error message ?> I need to know how I can make $price1-8 only show up if the corresponding $title is checked when this happens..........It will add all the prices up to tell a total price. here is the code that has that in it: <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['id'])) { echo 'Please <a href="login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it // Process the form if it is submitted // Set error message as blank upon arrival to page $errorMsg = ""; // First we check to see if the form has been submitted if (isset($_POST['eventid'])){ $name = ereg_replace("[^A-Z a-z0-9]", "", $_POST['name']); // filter everything but numbers and letters $event = ereg_replace("[^A-Z a-z0-9]", "", $_POST['event']); // filter everything but spaces, numbers, and letters $eventid = ereg_replace("[^A-Z a-z0-9]", "", $_POST['eventid']); // filter everything but spaces, numbers, and letters $subevent1 = ereg_replace("[^A-Z a-z0-9]", "", $_POST['subevent1']); // filter everything but spaces, numbers, and letters $subevent2 = ereg_replace("[^A-Za-z0-9]", "", $_POST['subevent2']); // filter everything but lowercase letters $subevent3 = ereg_replace("[^A-Za-z0-9]", "", $_POST['subevent3']); // filter everything but lowercase letters $subevent4 = ereg_replace("[^A-Za-z0-9]", "", $_POST['subevent4']); // filter everything but lowercase letters $subevent5 = ereg_replace("[^A-Za-z0-9]", "", $_POST['subevent5']); // filter everything but lowercase letters $subevent6 = ereg_replace("[^A-Z a-z0-9]", "", $_POST['subevent6']); // filter everything but $subevent7 = ereg_replace("[^A-Z a-z0-9]", "", $_POST['subevent7']); // filter everything but $subevent8 = ereg_replace("[^A-Z a-z0-9]", "", $_POST['subevent8']); // filter everything but $title1 = ereg_replace("[^A-Z a-z0-9]", "", $_POST['title1']); // filter everything but spaces, numbers, and letters $title2 = ereg_replace("[^A-Za-z0-9]", "", $_POST['title2']); // filter everything but lowercase letters $title3 = ereg_replace("[^A-Za-z0-9]", "", $_POST['title3']); // filter everything but lowercase letters $title4 = ereg_replace("[^A-Za-z0-9]", "", $_POST['title4']); // filter everything but lowercase letters $title5 = ereg_replace("[^A-Za-z0-9]", "", $_POST['title5']); // filter everything but lowercase letters $title6 = ereg_replace("[^A-Z a-z0-9]", "", $_POST['title6']); // filter everything but $title7 = ereg_replace("[^A-Z a-z0-9]", "", $_POST['title7']); // filter everything but $title8 = ereg_replace("[^A-Z a-z0-9]", "", $_POST['title8']); // filter everything but $userid = ereg_replace("[^A-Z a-z0-9]", "", $_POST['userid']); // filter everything but $email = ereg_replace("[^A-Z a-z0-9.@]", "", $_POST['email']); // filter everything but $price1 = ereg_replace("[^A-Z a-z0-9.@]", "", $_POST['price1']); // filter everything but $price2 = ereg_replace("[^A-Z a-z0-9.@]", "", $_POST['price2']); // filter everything but $price3 = ereg_replace("[^A-Z a-z0-9.@]", "", $_POST['price3']); // filter everything but $price4 = ereg_replace("[^A-Z a-z0-9.@]", "", $_POST['price4']); // filter everything but $price5 = ereg_replace("[^A-Z a-z0-9.@]", "", $_POST['price5']); // filter everything but $price6 = ereg_replace("[^A-Z a-z0-9.@]", "", $_POST['price6']); // filter everything but $price7 = ereg_replace("[^A-Z a-z0-9.@]", "", $_POST['price7']); // filter everything but $price8 = ereg_replace("[^A-Z a-z0-9.@]", "", $_POST['price8']); // filter everything but $sql = "REPLACE INTO Events (name, event, eventid, userid, title1, title2, title3, title4, title5, title6, title7, title8, email) VALUES('$name','$event','$eventid','$userid','$title1','$title2','$title3','$title4','$title5','$title6','$title7','$title8', '$email')"; $rs = mysql_query($sql) or die ("Problem with the query: $sql<br>" . mysql_error()); $total = $price1 + $price2 + $price3 + $price4 + $price5 + $price6 + $price7 + $price8; $to = "$email"; // Change this to your site admin email $from = "events@final.net46.net"; $subject = "Thank You for Registering for $event. "; //Begin HTML Email Message where you need to change the activation URL inside $message = "<html> <head> <style type='text/css'> #apDiv1 { position:absolute; left:338px; top:278px; width:311px; height:129px; z-index:1; } #pic { position:relative; left:0px; top:0px; } #apDiv2 { position:absolute; left:50px; top:207px; width:181px; height:149px; z-index:2; } #apDiv2 { text-align: center; } </style> </head> <body><div id='apDiv1'> <table width='408' border='1' cellspacing='2' cellpadding='2'> <tr> <th width='90' scope='col'>Event(s):</th> <th width='298' scope='col'>"; $sql = ("SELECT * FROM Events WHERE eventid='$eventid'"); $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ $event = $row['event']; $startdate = $row['startdate']; $enddate = $row['enddate']; $description = $row['description']; $location = $row['location']; $subevent1 = $row['subevent1']; $subevent2 = $row['subevent2']; $subevent3 = $row['subevent3']; $subevent4 = $row['subevent4']; $subevent5 = $row['subevent5']; $subevent6 = $row['subevent6']; $subevent7 = $row['subevent7']; $subevent8 = $row['subevent8']; } if (!empty($title1)) { $message .= "<br/>$title1"; } if (!empty($title2)) { $message .= "<hr><br/>$title2" ; } if (!empty($title3)) { $message .= "<hr><br/>$title3"; } if (!empty($title4)) { $message .= "<hr><br/>$title4"; } if (!empty($title5)) { $message .= "<hr><br/>$title5"; } if (!empty($title6)) { $message .= "<hr> <br/>$title6"; } if (!empty($title7)) { $message .= "<hr><br/>$title7"; } if (!empty($title8)) { $message .= "<hr><br/>$title8"; } echo "</div>"; ?> <?php $message .=" </th> </tr> <tr> <th>Price:</th> <th> $ $total </th> </tr>"; ?> <?php $message .=" <tr> <th>Registrant:</th> <th> $name </th> </tr> </table>"; ?> <?php $message .=" <div id='pic'> <img src=\"http://final.net46.net/button/boyscout.jpg\"> <div id='apDiv2'>$name <p> </p> <p> </p> <p><a href='final.net46.net' target='_new'><strong>Troop 78 Home</strong></a></p> <p> </p> <p> </p> <p><strong><a href='http://www.cornhuskercouncil.org'>Cornhusker Council</a></strong></p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> </div> </body> </html>"; ?> <?php // end of message $headers = "From: $from\r\n"; $headers .= "Content-Type: text/html\r\n"; $to = "$to"; // Finally send the activation email to the member mail($to, $subject, $message, $headers); // Then print a message to the browser for the joiner echo "<br /><br /><br /><h4>OK $firstname, one last step to verify your email identity:</h4><br /> We just sent an Activation link to: $email<br /><br /> <strong><font color=\"#990000\">Please check your email inbox in a moment</font></strong> to click on the Activation <br /> Link inside the message. After email activation you can log in."; $to = "searls03@gmail.com"; // Change this to your site admin email $from = "events@final.net46.net"; $subject = "New Registration for $event"; //Begin HTML Email Message where you need to change the activation URL inside $mailimg = ' <img src="http://final.net46.net/button/boyscout.jpg"</a> '; $message = "<html> <style type='text/css'> #apDiv1 { position:absolute; left:338px; top:278px; width:311px; height:129px; z-index:1; } #apDiv2 { position:absolute; left:50px; top:207px; width:181px; height:149px; z-index:2; } #apDiv2 { text-align: center; } body { background-image: url(final.net46.net/button/boyscout.jpg); background-repeat: no-repeat; } </style> </head> <body><div id='apDiv1'> <table width='408' border='1' cellspacing='2' cellpadding='2'> <tr> <th width='90' scope='col'>Event(s):</th> <th width='298' scope='col'>"; $sql = ("SELECT * FROM Events WHERE eventid='$eventid'"); $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ $event = $row['event']; $startdate = $row['startdate']; $enddate = $row['enddate']; $description = $row['description']; $location = $row['location']; $subevent1 = $row['subevent1']; $subevent2 = $row['subevent2']; $subevent3 = $row['subevent3']; $subevent4 = $row['subevent4']; $subevent5 = $row['subevent5']; $subevent6 = $row['subevent6']; $subevent7 = $row['subevent7']; $subevent8 = $row['subevent8']; } if (!empty($title1)) { $message .= "<br/>$title1"; } if (!empty($title2)) { $message .= "<hr><br/>$title2" ; } if (!empty($title3)) { $message .= "<hr><br/>$title3"; } if (!empty($title4)) { $message .= "<hr><br/>$title4"; } if (!empty($title5)) { $message .= "<hr><br/>$title5"; } if (!empty($title6)) { $message .= "<hr> <br/>$title6"; } if (!empty($title7)) { $message .= "<hr><br/>$title7"; } if (!empty($title8)) { $message .= "<hr><br/>$title8"; } ?> <?php $message .=" </th> </tr> <tr> <th>Price:</th> <th> $ $total </th> </tr>"; ?> <?php $message .=" <tr> <th>Registrant:</th> <th> $name </th> </tr> </table>"; ?> <?php $message .=" </div> <div id='apDiv2'>$name <p> </p> <p> </p> <p><a href='final.net46.net' target='_new'><strong>Troop 78 Home</strong></a></p> <p> </p> <p> </p> <p><strong><a href='http://www.cornhuskercouncil.org'>Cornhusker Council</a></strong></p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> </body> </html>"; // end of message $headers = "From: $from\r\n"; $headers .= "Content-Type: text/html\r\n"; $to = "$to"; $message .= $mailimg . $message; // Finally send the activation email to the member mail($to, $subject, $message, $headers); // Then print a message to the browser for the joiner echo mysql_error(); // close if post exit(); // Exit so the form and page does not display, just this success message }// Close else after database duplicate field value checks // Close else after missing vars check //Close if $_POST ?> Does this make sense? as of right now, if there is a price present in database, they all will be added together, not just checked ones..........help!!!!!
-
sorry, I am having a block right now..........could you help me get started with a code to upload directly to server from a form field?
-
how would I make it so that if the format was pdf.....it could be downloaded?
-
so I want to know how I could upload a document associated with an event.......with a form upload.......but where do I store it at and make it display in the view page for the event......?
-
no it doesn't...........it doesnt display the you are already registered if I it already is registered..............needs to associate eventid with titles and userid........help
-
alright......maybe this is kinda close? or maybe not.......maybe inspire someone? <?php //Search 'events' table for the username //I don't know where you're storing username, but I've assumed It's defined as $username $sql = "SELECT * FROM `Events` WHERE eventid = '".$_GET['eventid']."'"; $res = mysql_query($sql) or die(mysql_error()); $num = mysql_num_rows($res); ?> <?php $sql = mysql_query("SELECT * FROM Registration WHERE eventid=".$_GET['eventid']." LIMIT 1"); while($row = mysql_fetch_array($sql)){ $eventid = $row["eventid"]; $event = $row["event"]; $startdate = $row["startdate"]; $enddate = $row["enddate"]; $description = $row["description"]; $location = $row["location"]; $title1 = $row['title1']; $title2 = $row['title2']; $title3 = $row['title3']; $title4 = $row['title4']; $title5 = $row['title5']; $title6 = $row['title6']; $title7 = $row['title7']; $title8 = $row['title8']; $price1 = $row['price1']; $price2 = $row['price2']; $price3 = $row['price3']; $price4 = $row['price4']; $price5 = $row['price5']; $price6 = $row['price6']; $price7 = $row['price7']; $price8 = $row['price8']; $date1 = $row['date1']; $date2 = $row['date2']; $date3 = $row['date3']; $date4 = $row['date4']; $date5 = $row['date5']; $date6 = $row['date6']; $date7 = $row['date7']; $date8 = $row['date8']; //this will echo the contents of each db row as they are iterated in the loop ############################# echo "<form action ='eventreg.php' method='post'>"; echo "<center><table border='1' width='600'>"; if ($al){ echo "<tr><td width='300'><strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title1)) { echo "<tr><td width='300'> <input type='checkbox' name='title1' value='$title1'/></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> "; } if ($num['title2'] > 0 ){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title2)) { echo "<br/><tr><td> <input type='checkbox' name='title2' value='$title2' /></td><td><strong>$title2 </strong><br /> $date2 <br />$ $price2 </tr></td>" ; } if ($num['title3'] > 0 ){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title3)) { echo "<br/><tr><td><input type='checkbox' name='title3' value='$title3' /></td><td><strong>$title3</strong> <br /> $date3 <br />$ $price3</tr></td>"; } if ($num['title4'] > 0 ){ echo "<tr><td width='100'><strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title4)) { echo "<br/><tr><td><input type='checkbox' name='title4' value='$title4' /></td><td><strong>$title4</strong> <br /> $date4 <br />$ $price4</tr></td>"; } if ($num['title5'] > 0 ){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title5)) { echo "<br/><tr><td><input type='checkbox' name='title5' value='$title5' /></td><td><strong>$title5</strong> <br /> $date5 <br />$ $price5</tr>"; } if ($num['title6'] > 0 ){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title6)) { echo "<br/><tr><td> <input type='checkbox' name='title6' value='$title6' /></td><td><strong>$title6 </strong><br /> $date6 <br />$ $price6</tr></td>"; } if ($num['title7'] > 0 ){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title7)) { echo "<br/><tr><td> <input type='checkbox' name='title7' value='$title7' /></td><td><strong>$title7</strong> <br /> $date7 <br />$ $price7</tr></td>"; } if ($num['title8'] > 0 ){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title8)) { echo "<br/><tr><td> <input type='checkbox' name='title8' value='$title8' /></td><td><strong>$title8</strong> <br /> $date8 <br />$ $price8</tr></td>"; } echo "</table>"; echo "<input name='userid' type=\"hidden\" value=\"$userid\" />"; echo "<input name='eventid' type=\"hidden\" value=\"$eventid\" />"; echo "<input name='email' type=\"text\" value=\"$email\" />"; echo "<input name='event' type=\"hidden\" value=\"$event\" />"; echo "<input name='name' type=\"hidden\" value=\"$name\" />"; echo "<input name=\"save\" type=\"submit\" value=\"Register Now!\" />"; echo "<input name='price1' type=\"hidden\" value=\"$price1\" />"; echo "<input name='price2' type=\"hidden\" value=\"$price2\" />"; echo "<input name='price3' type=\"hidden\" value=\"$price3\" />"; echo "<input name='price4' type=\"hidden\" value=\"$price4\" />"; echo "<input name='price5' type=\"hidden\" value=\"$price5\" />"; echo "<input name='price6' type=\"hidden\" value=\"$price6\" />"; echo "<input name='price7' type=\"hidden\" value=\"$price7\" />"; echo "<input name='price8' type=\"hidden\" value=\"$price8\" />"; echo "</center></form>"; } //etc etc //If it finds a match, output an error message ?>
-
any suggestions????????
-
does that make sense?
-
but if I need to know how to make it so that if a person has registered for a subevent it will display...........how it is set up makes it so that if any subevent has the name by it...........it will disable all the fields instead of just one......
-
ok I came up with this: if($num>0){ echo "<tr><td width='300'> You have already registered for this event</td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title1)) { echo "<tr><td width='100'> <input type='checkbox' name='title1' value='$title1'/></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> "; } if($num>0){ echo "<tr><td width='100'> You have already registered for this event</td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> ";} else if (!empty($title2)) { echo "<br/><tr><td> <input type='checkbox' name='title2' value='$title2' /></td><td><strong>$title2 </strong><br /> $date2 <br />$ $price2 </tr></td>" ; } but this will make it so that if it is present in any subevent, it wont work........so how do I make it subevent specific........$num is defined before, just not shown....
-
ok, so how do i make it so that the table always displays and so that this will display in a table row if the registration is already present?
-
So which piece should be in the array part of the loop of the if statement..........does this make sense?
-
k, so I figured out I needed to make submit an array...............although I don't think that is what I want to do is it? <?php if (isset($_POST['submitted'])) { include('connect1.php'); $category = $_POST['category']; $criteria = $_POST['criteria'] ; $query = ("SELECT name, badges, rank, userid FROM members WHERE $category LIKE '%".$criteria."%'"); $result = mysqli_query($dbcon, $query) or die('error getting data'); $num_rows = mysqli_num_rows($result); echo "$num_rows results found"; echo "<table width=\"896\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr bgcolor=\"#F7E496\"><td bgcolor=\"#F7E496\"><strong>name</strong></td><td bgcolor=\"#F7E496\" ><strong>Merit Badges</strong></td><td bgcolor=\"#F7E496\"><strong>Rank</strong></td><td bgclor=\"#F7E496\"></td></tr>"; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {$color = ($color == 'white')?'#fffccc':'white'; echo "<tr bgcolor='$color'><td> "; echo $row['name']; echo " </td><td> <form action=\"scout.php\" method=\"post\"> <input type=\"text\" name=\"userid\" id=\"userid\" value='".$row['userid']."'> <textarea name=\"badges[".$row['userid']."]\" id=\"badges\" cols=\"40\" rows=\"3\" type=\"textarea\">".$row['badges']."</textarea></td><td> <span class=\"adfa\"> </span> <select name=\"rank[".$row['userid']."]\" id=\"rank\"> <option value=\"Scout\">Scout</option> <option value=\"Tenderfoot\">Tenderfoot</option> <option value=\"Second Class Scout\">Second Class Scout</option> <option value=\"First Class Scout\">First Class Scout</option> <option value=\"Star Scout\">Star Scout</option> <option value=\"Life Scout\">Life Scout</option> <option value=\"Eagle Scout\">Eagle Scout</option> <option value=\"\" selected=\"selected\">".$row['rank']."</option> </td><td>"; } echo "</td></tr>"; echo "</table>"; echo "<input type=\"submit\" name='submit[".$row['userid']."]' id=\"submit\" value=\"Save\" /> </form>"; } ?>
-
is the array set up correctly? what about anything else? why wont this work.......the records updated doesn't show up so clearly something isn't working in the loop......
-
what is $PS?
-
what should I fix with it now?
-
oh yeah....the code was broken.....here is what I fixed it with: <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ [url=http://'http://www.flashbuilding.com/']www.flashbuilding.com[/url] -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['id'])) { echo 'Please <a href="login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display // Process the form if it is submitted if ($_POST['submit']) { $PS = $_POST['submit']; if(is_array($PS)) { foreach($PS as $user_id=>$type) { $badges = $type['badges']; $rank = $type['rank']; //user_id is now defined spin sql $sql = mysql_query("UPDATE members SET badges='$badges', rank='$rank' WHERE userid='".$user_id."'"); printf("Records updated: %d\n", mysql_affected_rows()); } } exit(); } // close if post ?>
-
it is not posting to database.
-
ok, so I have this code: <?php if (isset($_POST['submitted'])) { include('connect1.php'); $category = $_POST['category']; $criteria = $_POST['criteria'] ; $query = ("SELECT name, badges, rank, userid FROM members WHERE $category LIKE '%".$criteria."%'"); $result = mysqli_query($dbcon, $query) or die('error getting data'); $num_rows = mysqli_num_rows($result); echo "$num_rows results found"; echo "<table width=\"896\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr bgcolor=\"#F7E496\"><td bgcolor=\"#F7E496\"><strong>name</strong></td><td bgcolor=\"#F7E496\" ><strong>Merit Badges</strong></td><td bgcolor=\"#F7E496\"><strong>Rank</strong></td><td bgclor=\"#F7E496\"></td></tr>"; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {$color = ($color == 'white')?'#fffccc':'white'; echo "<tr bgcolor='$color'><td> <input type=\"text\" name=\"userid\" id=\"userid\" value='".$row['userid']."'>"; echo $row['name']; echo " </td><td> <form action=\"scout.php\" method=\"post\"> <textarea name=\"badges\" id=\"badges\" cols=\"40\" rows=\"3\" type=\"textarea\">".$row['badges']."</textarea></td><td> <span class=\"adfa\"> </span> <select name=\"rank\" id=\"rank\"> <option value=\"Scout\">Scout</option> <option value=\"Tenderfoot\">Tenderfoot</option> <option value=\"Second Class Scout\">Second Class Scout</option> <option value=\"First Class Scout\">First Class Scout</option> <option value=\"Star Scout\">Star Scout</option> <option value=\"Life Scout\">Life Scout</option> <option value=\"Eagle Scout\">Eagle Scout</option> <option value=\"\" selected=\"selected\">".$row['rank']."</option> </td><td>"; echo "<input type=\"submit\" name=\"submit\" id=\"submit\" value=\"Save\" /> "; echo "</form>"; } echo "</table>"; echo "</td></tr>"; } ?> and this is the code that does the posting: <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ [url=http://'http://www.flashbuilding.com/']www.flashbuilding.com[/url] -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['id'])) { echo 'Please <a href="login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display // Process the form if it is submitted if ($_POST['submit']) { $badges = $_POST['badges']; $userid = $_POST['userid']; $rank = $_POST['rank']; $sql = mysql_query("UPDATE members SET badges='$badges', rank='$rank' WHERE userid='".$_GET['userid']."'"); printf("Records updated: %d\n", mysql_affected_rows()) ; exit(); } // close if post ?> So what I need to know is how I can make it so that each result has it's user id associated with it......and I can update multiple rows at once according to each userid that is associated..........right now I can only get it to do one if I add on ?userid=".$row['userid']." in the first piece of code.......how can I make it update lets say 78 as soon as I click submit...... PS I know there will be a submit button with each row right now.......I will move it out of the loop later.....
-
ok, I guess it is also only updating mine too......
-
so I have it so it updates correct person now.......it only will display my id associated stuff in each $badges box for everyone.....: <?php if (isset($_POST['submitted'])) { include('connect1.php'); $category = $_POST['category']; $criteria = $_POST['criteria'] ; $query = "SELECT * FROM members WHERE $category LIKE '%".$criteria."%'"; $result = mysqli_query($dbcon, $query) or die('error getting data'); $num_rows = mysqli_num_rows($result); echo "$num_rows results found"; echo "<table width=\"896\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr bgcolor=\"#F7E496\"><td bgcolor=\"#F7E496\"><strong>name</strong></td><td bgcolor=\"#F7E496\" ><strong>Merit Badges</strong></td><td bgcolor=\"#F7E496\"><strong>Rank</strong></td><td bgclor=\"#F7E496\"></td></tr>"; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {$color = ($color == 'white')?'#fffccc':'white'; echo "<tr bgcolor='$color'><td> <input type=\"hidden\" name=\"userid\" id=\"userid\" value=".$row['userid'].">"; echo $row['name']; echo " </td><td> <form action=\"scout.php\" method=\"post\"> <textarea name=\"badges\" id=\"badges\" cols=\"40\" rows=\"3\" type=\"textarea\">$badges</textarea></td><td> <span class=\"adfa\"> </span> <label for=\"rank\"></label> <select name=\"rank\" id=\"rank\"> <option value=\"Scout\">Scout</option> <option value=\"Tenderfoot\">Tenderfoot</option> <option value=\"Second Class Scout\">Second Class Scout</option> <option value=\"First Class Scout\">First Class Scout</option> <option value=\"Star Scout\">Star Scout</option> <option value=\"Life Scout\">Life Scout</option> <option value=\"Eagle Scout\">Eagle Scout</option> <option value=\"\" selected=\"selected\"$rank></option> </td><td> "; } echo" <input type=\"submit\" name=\"submit\" id=\"submit\" value=\"Save\" /> </td></tr>"; echo "</form>"; echo "</table>"; } ?>