Jump to content

mike3075

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by mike3075

  1. First, I want to thank everyone for their time, suggestions and recommendations. Here are my responses to your questions, suggestions and recommendations: requinix: The “id” is not display after I click the Update button Pixeel: I honestly didn’t give the GET and POST methods much consideration. I will correct that. I didn’t realize I left MySQL credentials in the code I posted. Thank you for catching that! ginerjm: I think there were duplicate queries and not using the results is because I was trying different things and didn’t delete or comment out the old code Thank you for cleaning update the code for me. It is way easier to read now. The reason there are 3 separate tables right now is because the rows will eventually be color coded and I didn’t feel like bothering with the CSS right now The query will eventually only generate one row Pixeel: I will remove the extra queries and insert the validation. For right now though I know there should be certain data returned from MySQL DB. This merely for testing. Once everything is working I will insert the validation I will rename the variables as I go along ginerjm: I never really thought about leaving the ‘var’ off. I always thought it was easier to find the variables if ‘var’ was in front it Ultimately, when a user changes data and clicks Update it will update the DB. I set all the inputs to ‘textarea’ just so everything would be vertically aligned to the top
  2. I am stuck on this form. I can use <a href='courtdirectoryview.php?id={$row['id']}' target='_blank'> to pass the id number from courtdirectory.php to courtdirectoryview.php and all the data from the MySQL db is displayed correctly. When I make changes to test the update query and I click the Update button I get the error in the title. Line 42 is: echo "WHY DOES THE ID NUMBER NOT SHOW UP HERE WHEN THE UPDATE BUTTON IS CLICKED: " .$_GET['id']. "<br>"; Any suggestions or advice will be greatly appreciated <!DOCTYPE html> <head> <link rel="stylesheet" href="css/main-forcourtdirectory.css"> </head> <?php //============================================================================================================================================================================================/ //OPEN CONNECTION TO MYSQL ON LOCALHOST=======================================================================================================================================================/ $dbhost = 'localhost' ; $username = 'root' ; $password = '' ; $conn = mysqli_connect("$dbhost", "$username", "$password"); if (!$conn) { die('Could not connect: ' . mysqli_error()); } //CLOSE CONNECTION TO MYSQL ON LOCALHOST======================================================================================================================================================/ //============================================================================================================================================================================================/ //============================================================================================================================================================================================/ //OPEN CONNECTION TO MYSQL ON LOCALHOST=======================================================================================================================================================/ mysqli_select_db($conn, "courtdirectory"); //CLOSE CONNECTION TO MYSQL ON LOCALHOST======================================================================================================================================================/ //============================================================================================================================================================================================/ //============================================================================================================================================================================================/ // DEFINE VARIABLES AND SET EMPTY VALUES======================================================================================================================================================/ // PROSECUTOR VARIABLES=======================================================================================================================================================================/ $varprosecutor = $varprosecutoraddress = $varprosecutorphone = $varprosecutorfax = $varprosecutornotes = ""; //============================================================================================================================================================================================/ // PROSECUTOR ERROR VARIABLES=================================================================================================================================================================/ $varprosecutorErr = $varprosecutoraddressErr = $varprosecutorphoneErr = $varprosecutorfaxErr = $varprosecutornotesErr = ""; //============================================================================================================================================================================================/ // OTHER VARIABLES============================================================================================================================================================================/ $varmyid = $varipaddress = $formerror = $success = ""; //============================================================================================================================================================================================/ //============================================================================================================================================================================================/ //FORM SUBMITTED WITH POST METHOD=============================================================================================================================================================/ if ($_SERVER["REQUEST_METHOD"] == "POST") { //============================================================================================================================================================================================/ echo "WHY DOES THE ID NUMBER NOT SHOW UP HERE WHEN THE UPDATE BUTTON IS CLICKED: " .$_GET['id']. "<br>"; //==========================================================================================================================================================================================/ //START UPDATE SQL==========================================================================================================================================================================/ //NONE OF THIS CODE WILL WORK UNTIL I CAN GET THE ID NUMBER=================================================================================================================================/ //$result2 = mysqli_query($conn, "UPDATE courtdirectory SET prosecutor='$varprosecutor' WHERE courtdirectory.id = ($myid)") or die("Error: " . mysqli_error($conn)); //$retval3 = mysqli_query($conn, $result2); //if (mysqli_query($conn, $result2)) { // echo "Record updated successfully"; //} else { // echo "Error updating record: " . mysqli_error($conn); //} //END UPDATE SQL============================================================================================================================================================================/ //==========================================================================================================================================================================================/ }else{ if (isset($_GET['id'])) { $myid = $_GET['id']; $varmyid = $myid; } echo "I CAN GET THE ID NUMBER FROM THE COURTDIRECTORY.PHP PAGE: " .$myid. "<br>"; echo "I CAN SET THIS VARIABLE TO THE THE ID NUMBER: " .$varmyid. "<br>"; echo "<body>"; if (isset($_GET['id'])) { $myid = $_GET['id']; } $bulletinsQuery = "SELECT * FROM courtdirectory"; $bulletins = $conn->query($bulletinsQuery); if (isset($_GET['id'])) { $myid = $_GET['id']; } echo "<form action= " .$_SERVER['PHP_SELF']. " method='post'>"; echo "<table class='courtdirectorytable'>"; echo "<tbody>"; echo "<tr>"; echo "<th class='county'>County</th>"; echo "<th class='city'>City</th>"; echo "<th class='court'>Court</th>"; echo "<th class='judge'>Judge</th>"; echo "<th class='address'>Address</th>"; echo "<th class='phone'>Phone</th>"; echo "<th class='fax'>Fax</th>"; echo "<th class='notes'>Court Notes</th>"; echo "</tr>"; $sql2 = "SELECT * FROM courtdirectory WHERE courtdirectory.id = ($myid)"; $retval2 = mysqli_query($conn, $sql2); $result2 = mysqli_query($conn, "SELECT * FROM courtdirectory WHERE courtdirectory.id = ($myid)") or die("Error: " . mysqli_error($conn)); while($row = mysqli_fetch_array($retval2, MYSQLI_ASSOC)) { $varprosecutor = $row['prosecutor']; $varprosecutoraddress = str_replace(',', '&#13;&#10;', $row['prosecutoraddress1']); $varprosecutorphone = $row['prosecutorphone']; $varprosecutorfax = $row['prosecutorfax']; $varprosecutornotes = $row['prosecutornotes']; $varprosecutornotes = str_replace(['<br/>','</br>','<br />'], '&#13;&#10;', $row['prosecutornotes']); echo "<tr>"; echo "<td class='county'>" .$row['county']. "</td>"; echo "<td class='city'>" .$row['city']. "</td>"; echo "<td class='court'>" .$row['court']. "</td>"; echo "<td class='judge'>" .$row['judge']. "</td>"; echo "<td class='address'>" .$row['address']. "</td>"; echo "<td class='phone'>" .$row['phone']. "</td>"; echo "<td class='fax'>" .$row['fax']. "</td>"; echo "<td class='notes'>" .$row['notes']. "</td>"; echo "</tr>"; echo "</tbody>"; echo "</table>"; echo "</br>"; echo "<table class='courtdirectorytable'>"; echo "<tbody>"; echo "<tr>"; echo "<th class='prosecutor'>Prosecutor</th>"; echo "<th class='prosecutoraddress'>Prosecutor Address</th>"; echo "<th class='prosecutorphone'>Prosecutor Phone</th>"; echo "<th class='prosecutorfax'>Prosecutor Fax</th>"; echo "<th class='prosecutornotes'>Prosecutor Notes</th>"; echo "</tr>"; echo "<tr>"; echo "<td class='prosecutor'><textarea class='prosecutor' value='$varprosecutor'>$varprosecutor</textarea></td>"; echo "<td class='prosecutoraddress'><textarea class='prosecutoraddress' value='$varprosecutoraddress'>$varprosecutoraddress</textarea></td>"; echo "<td class='prosecutorphone'><textarea class='prosecutorphone' value='$varprosecutorphone'>$varprosecutorphone</textarea></td>"; echo "<td class='prosecutorfax'><textarea class='prosecutorfax' value='$varprosecutorfax'>$varprosecutorfax</textarea></td>"; echo "<td class='prosecutornotes'><textarea class='prosecutornotes' value='$varprosecutornotes'>$varprosecutornotes</textarea></td>"; echo "</tr>"; echo "</tbody>"; echo "</table>"; echo "<table class='submitbutton'>"; echo "<tbody>"; echo "<tr>"; echo "<td class='submitbutton'><button type='submit' class='courtdirectory-submit' name='submit' tabindex='6' data-submit='...Sendng'>Update</button></td>"; echo "</tr>"; echo "</tbody>"; echo "</table>"; } echo "</form>"; echo "</body>"; } ?> </html>
  3. Thank all of you that responded so quickly. For now, I just used the code from another form instead of using the function to populate the select box so I could get the form up and running. It's bulk but it works for now. When I gain more experience and knowledge I will go back and work on it. Again, thanks to everyone for the advice and suggestions!
  4. mac_gyver, to be honest with you your 2nd paragraph went over my head. I have a select box on another form that works fine <select class="myselectbox" name="varposition" id="varposition" tabindex="5"><option value="" selected disabled>Select one...</option><option value="Chaperone" <?php if (isset($varposition) && $varposition == "Chaperone") echo "selected" ?>>Chaperone</option><option value="Class Monitor" <?php if (isset($varposition) && $varposition == "Class Monitor") echo "selected" ?>>Class Monitor</option></select> I suppose I could modify it for each state, but I has hoping there would be an easier way
  5. Thank you both for the quick response. I tried changing the While statement in the function to following, but it didn't work. It still did the same thing. while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC)) { $rec = $row['name']; echo "<option value = " . $row['name']. " if (isset($varfatherbirthstate) && $varfatherbirthstate == " . $row['name']. ") echo 'selected' >" . $row['name']. "</option>"; } Please forgive me if I'm way off on this. I am still fairly new to PHP
  6. I have a select box on a form that is populated with the following function: function getStates(){ // OPEN CONNECTION TO MYSQL ON LOCALHOST $dbhost = 'localhost' ; $username = 'root' ; $password = '' ; $conn = mysqli_connect("$dbhost", "$username", "$password"); if (!$conn) { die('Could not connect: ' . mysqli_error()); } mysqli_select_db($conn, "mydb"); $retval = mysqli_query($conn, "SELECT * FROM tblstates") or die("Error: " . mysqli_error($conn)); echo "<option value=''>Select one...</option>"; while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC)) { $rec = $row['name']; echo "<option value = " . $row['name']. ">"; echo $row['name']; echo "</option>"; } } On the form I have several text boxes and the following select box: <div class="formfieldgroup"> <label class="label">Birth State/Country: <span class="required">&#149;</span></label> <select class="fatherbirthstate" name="varfatherbirthstate" tabindex="9"><?=getStates()?></select> <span class="form-error2"><?= $varfatherbirthstateErr ?></span> </div> TESTING: I intentionally leave a text box blank so I will get an error and I make sure to make a selection from the select box. PROBLEM: When the form is submitted, the select box doesn't retain the value selected and is reset to "Select one..." QUESTION: How do I go about retaining the selected value when the form errors?
  7. Here is the code I have to process a contact form: <?php // DEFINE VARIABLE AND SET EMPTY VALUES $varfnameErr = $varlnameErr = $varemailErr = $varphoneErr = $varmessageErr = ""; $varfname = $varlname = $varemail = $varphone = $varmessage = $varipaddress = $formerror = $success = ""; $varfnameErr = $_REQUEST['varfnameErr'] ; $varlnameErr = $_REQUEST['varlnameErr'] ; $varemailErr = $_REQUEST['varemailErr'] ; $varphoneErr = $_REQUEST['varphoneErr'] ; $varmessageErr = $_REQUEST['varmessageErr'] ; $varfname = $_REQUEST['varfname'] ; $varlname = $_REQUEST['varlname'] ; $varemail = $_REQUEST['varemail'] ; $varphone = $_REQUEST['varphone'] ; $varmessage = $_REQUEST['varmessage'] ; $varipaddress = $_REQUEST['varipaddress'] ; $message = '<html><body>'; $message .= '<p>Form submitted by: ' .$varfname. ' ' .$varlname. '</p>'; $message .= '<p>Email: ' .$varemail. '</p>'; $message .= '<p>Phone Number: ' .$varphone. '</p>'; $message .= '<p>Message: ' .$varmessage. '</p>'; $message .= '<p>IP Address: ' .$varipaddress. '</p>'; $message .= '</body></html>'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require $_SERVER['DOCUMENT_ROOT'] . '/mail/Exception.php'; require $_SERVER['DOCUMENT_ROOT'] . '/mail/PHPMailer.php'; require $_SERVER['DOCUMENT_ROOT'] . '/mail/SMTP.php'; $mail = new PHPMailer; $mail->isSMTP(); $mail->SMTPDebug = 2; // 0 = off (for production use) - 1 = client messages - 2 = client and server messages $mail->Host = "HostIsBlueHost"; // use $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6 $mail->Port = 21; // TLS only $mail->SMTPSecure = 'tls'; // ssl is deprecated $mail->SMTPAuth = true; $mail->Username = 'info@aacroofing.org'; // email $mail->Password = 'PasswordWasHere'; // password $mail->setFrom($varemail); // From email and name $mail->addAddress('test@gmail.com'); // to email and name $mail->Subject = 'Contact Us Form Submission'; $mail->msgHTML($message); //$mail->msgHTML(file_get_contents('contents.html'), __DIR__); //Read an HTML message body from an external file, convert referenced images to embedded, $mail->AltBody = 'HTML messaging not supported'; // If html emails is not supported by the receiver, show this body //$mail->addAttachment('images/phpmailer_mini.png'); //Attach an image file $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); if(!$mail->send()){ echo "Mailer Error: " . $mail->ErrorInfo; }else{ $success = "<p class='success'>Message sent! Thank you!</br>IP Address: " .$varipaddress. " recorded</p>"; $varfname = $varlname = $varemail = $varphone = $varmessage = ""; } ?> When the form is completed and submitted this is the error that I get. I have no idea what this means. If someone understands the error, could you please give me a clue? 2020-03-08 19:48:46 SERVER -> CLIENT: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------220-You are user number 1 of 150 allowed.220-Local time is now 13:48. Server port: 21.220-IPv6 connections are also welcome on this server.220 You will be disconnected after 15 minutes of inactivity. 2020-03-08 19:48:46 CLIENT -> SERVER: EHLO aacroofing.org 2020-03-08 19:48:46 SERVER -> CLIENT: 530 You aren't logged in 2020-03-08 19:48:46 SMTP ERROR: EHLO command failed: 530 You aren't logged in 2020-03-08 19:48:46 CLIENT -> SERVER: HELO aacroofing.org 2020-03-08 19:48:46 SERVER -> CLIENT: 530 You aren't logged in 2020-03-08 19:48:46 SMTP ERROR: HELO command failed: 530 You aren't logged in 2020-03-08 19:48:46 CLIENT -> SERVER: STARTTLS 2020-03-08 19:48:46 SERVER -> CLIENT: 530 You aren't logged in 2020-03-08 19:48:46 SMTP ERROR: STARTTLS command failed: 530 You aren't logged in SMTP Error: Could not connect to SMTP host. 2020-03-08 19:48:46 CLIENT -> SERVER: QUIT 2020-03-08 19:48:46 SERVER -> CLIENT: 221-Goodbye. You uploaded 0 and downloaded 0 kbytes.221 Logout. SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
  8. Ginerjm, that worked! Thank you very much! requinix, I will create a test page using PHPMailer. Thank you both for your suggestions!
  9. It's not. I will change it and see what happens. Thank you
  10. I really need some help. I am very new to PHP and I've been stuck for a couple of days. I created a contact form and everything seems to be working correctly, except the mail is showing it's sent, but I never receive an email in my Inbox or Spam folder. Can someone please review my code? Here is the PHP: <?php // DEFINE VARIABLE AND SET EMPTY VALUES $varfnameErr = $varlnameErr = $varemailErr = $varphoneErr = $varpositionErr = ""; $varfname = $varlname = $varemail = $varphone = $varposition = $success = ""; //FORM SUBMITTED WITH POST METHOD if ($_SERVER["REQUEST_METHOD"] == "POST") { //VALIDATE FIRST NAME if (empty($_POST["varfname"])) { $varfnameErr = "First Name is required"; } else { $varfname = test_input($_POST["varfname"]); // MAKE SURE FIRST NAME ONLY CONTAINS LETTERS AND WHITE SPACE if (!preg_match("/^[a-zA-Z ]*$/",$varfname)) { $varfnameErr = "Only letters and white space are allowed"; } } //VALIDATE LAST NAME if (empty($_POST["varlname"])) { $varlnameErr = "Last Name is required"; } else { $varlname = test_input($_POST["varlname"]); // MAKE SURE LAST NAME ONLY CONTAINS LETTERS AND WHITE SPACE if (!preg_match("/^[a-zA-Z ]*$/",$varlname)) { $varlnameErr = "Only letters and white space are allowed"; } } //VALIDATE EMAIL ADDRESS if (empty($_POST["varemail"])) { $varemailErr = "Email Address is required"; } else { $varemail = test_input($_POST["varemail"]); // MAKE SURE EMAIL ADDRESS IS FORMATTED CORRECTLY if (!filter_var($varemail, FILTER_VALIDATE_EMAIL)) { $varemailErr = "Invalid email address format"; } } //VALIDATE PHONE NUMBER if (empty($_POST["varphone"])) { $varphoneErr = "Phone number is required"; } else { $varphone = test_input($_POST["varphone"]); // MAKE SURE PHONE NUMBER IS IN CORRECT FORMAT if (!preg_match("/^(\d[\s-]?)?[\(\[\s-]{0,2}?\d{3}[\)\]\s-]{0,2}?\d{3}[\s-]?\d{4}$/i",$varphone)) { $varphoneErr = "Invalid telephone format"; } } //VALIDATE POSITION if (empty($_POST["varposition"])) { $varpositionErr = "Position is required"; } else { $varposition = test_input($_POST["varposition"]); } //IF ALL DATA IS CORRECT if ($varfnameErr == '' and $varlnameErr == '' and $varemailErr == '' and $varphoneErr == '' and $varpositionErr == '') { $message_body = ''; unset($_POST['submit']); //THIS IS JUST FOR TESTING PURPOSES $message_body = $varfname; //foreach ($_POST as $key => $value) { // $message_body .= "$key: $value\n"; //} $to = 'mygmail@gmail.com'; $subject = 'Volunteer Form Submission'; $message = wordwrap($message_body, 70); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= "From: " . $varemail . "\r\n"; $subject = 'Volunteer Form Submission'; $to = 'mygmail@gmail.com'; $result = mail($to, $subject, $message, $headers); //THIS RETURNS "1" print $result; //IF ALL DATA IS CORRECT MAKE SURE EMAIL WAS SENT if (mail($to, $subject, $message, $headers)) { $success = "Message sent. Thank you contacting us! We will reply as soon as possible."; $varfname = $varlname = $varemail = $varphone = $varposition = ""; } else { $success = "Something went wrong!"; } } } //STRIP UNWANTED CHARACTERS FROM VARIABLES function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> Here is the HTML: <div class="row regformrow"> <div class="coffee-span-12 regformcolumn"> <div class="subgrid regformsubgrid"> <div class="row regformsubgridheaderrow"> <div class="coffee-span-12 regformsubgridheadercolumn"> <h4 class="regformsubgridheadertitle">Volunteer Form</h4> </div> </div> <div class="row regformsubgridrow"> <form class="form-container regformsubgridformcontainer" action=<?= $_SERVER['PHP_SELF']; ?> method="post"> <div class="coffee-span-4 coffee-972-span-6 coffee-458-span-12 regformsubgridcolumn1"> <div class="container regformsubgridcontainer1"> <label class="label form-label-all"><span style="font-style:italic;color:#FF5454;">* Required Fields</span></label></br> <div class="formfieldgroup"> <input class="fname" name="varfname" type="text" tabindex="1" placeholder="First Name" value="<?= $varfname; ?>"><span class="requiredfield"> *</span> <span class="form-error"><?= $varfnameErr ?></span> </div> <div class="formfieldgroup"> <input class="lname" name="varlname" type="text" tabindex="2" placeholder="Last Name" value="<?= $varlname; ?>"><span class="requiredfield"> *</span> <span class="form-error"><?= $varlnameErr ?></span> </div> <div class="formfieldgroup"> <input class="email" name="varemail" type="text" tabindex="2" placeholder="Email Address" value="<?= $varemail; ?>"><span class="requiredfield"> *</span> <span class="form-error"><?= $varemailErr ?></span> </div> <div class="formfieldgroup"> <input class="phone" name="varphone" type="text" tabindex="2" placeholder="Telephone Number" value="<?= $varphone; ?>"><span class="requiredfield"> *</span> <span class="form-error"><?= $varphoneErr ?></span> </div> <div class="formfieldgroup"> <select class="select selectbox" name="varposition" id="varposition" tabindex="5"><option value="">Select one...</option><option value="Chaperone">Chaperone</option><option value="Class Monitor">Class Monitor</option><option value="Parking Attendant">Parking Attendant</option><option value="Party Coordinator">Party Coordinator</option><option value="Teacher Aid">Teacher Aid</option></select><span class="requiredfield"> *</span> <span class="form-error"><?= $varpositionErr ?></span> </div> <div class="formfieldgroup"> <input class="test" name="test" type="text" tabindex="6" placeholder="If you are human, leave this field blank" value=""> </div> <div class="formfieldgroup"> <button type="submit" class="button-submit-1" name="submit" tabindex="7" data-submit="...Sendng">Submit</button> </div> <div class="formfieldgroup"> <div class="success"><?= $success; ?></div> </div> </div> </div> </form> </div> </div> </div> </div>
  11. I have only been working with PHP for about a week, so please be patient. I need to convert the following ASP Classic code to PHP. I have the SQL partially working. <label>Select a bulletin:</label> <select> <option value="">Select One</option> <?php $servername = "localhost"; $username = "username"; $password = "password"; $conn = new mysqli($servername, $username, $password); if (!$conn) { die('Could not connect: ' . mysql_error()); } $sql = "SELECT bulletinid, bulletindate, bulletinlink, bulletintext FROM tblbulletins"; mysql_select_db(MyDB); $retrieved = mysql_query( $sql, $conn ); if(! $retrieved ) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_array($retrieved, MYSQL_ASSOC)) { $bullentinid = $row['bulletinid']; $bullentindate = $row['bulletindate']; $bullentinlink = $row['bulletinlink']; echo $link; } mysql_close($conn); ?> </select> The records that are retrieved are: | 01 | 05/01/19 - 05/07/19 | link 1 | <embed src="bul/05-01.pdf#"> | | 02 | 05/08/19 - 05/14/19 | link 2 | <embed src="bul/05-08.pdf#"> | | 03 | 05/15/19 - 05/21/19 | link 3 | <embed src="bul/05-15.pdf#"> | The problem I'm having is converting line 10 in ASP Classic to PHP: 01. <% Function bulletins %> 02. <% sSQL = "SELECT bulletinid, bulletindate, bulletinlink, bulletintext FROM tblbulletins ORDER BY bulletinid" %> 03. <% Set oRecordSet = adoCon.Execute(sSQL) %> 04. <% If Not oRecordSet.EOF Then %> 05. <% arrayResult1 = oRecordSet.GetRows() %> 06. <% End If %> 07. <% Set oRecordSet = Nothing %> 08. <% iRowNumber1 = ubound(arrayResult1,2) %> 09. <% For iCounter1= 0 to iRowNumber1 %> 10. <% Response.Write ("<option value="pg01.php?mode=view&ID=<%=arrayResult1(0,iCounter1)%>"><% = arrayResult1(1,iCounter1) %></option>") 11. <% Next %> 12. <% End Function %> 13. <% 'arrayResult1(0,iCounter1) = bulletinid %> 14. <% 'arrayResult1(1,iCounter1) = bulletindate %> 15. <% 'arrayResult1(2,iCounter1) = bulletinlink %> 16. <% 'arrayResult1(3,iCounter1) = bulletintext %> 17. <label>Select bulletin:</label> 18. <select> 19. <% Call bulletins %> 20. </select> Once the link was clicked, it would open pg01.php to the specific saint that was selected. Here is the ASP Classic code on pg01.asp that needs to be converted to PHP: <% IF Request.querystring("mode") = "view" THEN %> <% Session("bulletinid") = Request.querystring("ID") %> <% bulletinID = Clng(Session("bulletinID")) %> <% sSQL = "SELECT * FROM tblbulletins WHERE bulletinid = " & bulletinID %> <% Set oRecordSet = adoCon.Execute(sSQL) %> <% IF Not oRecordSet.EOF THEN %> <% arrayResult = oRecordSet.GetRows() %> <% END IF %> <% END IF %> <% Set oRecordSet = Nothing %> <div class="main"> <h4><% =arrayResult(1,0) %></h4> <p><%=arrResultSet(4,0)%></p> </div>
×
×
  • 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.