PHP - Display Part Of A String
Let's say I have a variable called $big_paragraph
I want to display the variable IF it contains the word "hello". The word may or may not be there AND it could be anywhere in that paragraph (separated by a space before and after it to signify that it is a word). So I can't use substr since it assumes I know the position. Thanks. Similar TutorialsI'm using PHP to get a list of names from a mysql database, which then produces a drop down list for the user to select an option and then progress to the next page where the selection is displayed with other stuff. My problem is that my drop down list works fine, but when the user goes to the next page only the first part of the string is displayed, ie if the string is Fred Bloggs, only Fred is shown. I can get it to work by adding ' ' around the string name in the option section, but this shows 'Fred Bloggs' in the drop down list which isn't very pretty. I haven't got the actual code to hand at the moment, but any ideas on where I'm going wrong? Cheers Hello guys, I want to remove part of a string and convert it to a var instead of echoing it out.. How would I do it.. $string = "temp_photo/testing.jpg"; I want to remove temp_photo so the out put should be $filename2 = testing.jpg Please advise.. Thanks, Dan Hi - newbie to php - I need to search a string and possibly replace part of it. This is how I would do it in perl: Code: [Select] if ($homepage) { if ($homepage !~ /http/i) { $homepage = "http:\/\/" . $homepage; } } I have a homepage field in the database but sometimes people put the http in, and sometimes they leave it out. In perl I can figure it out and format accordingly but it doesn't work in PHP. I'm not sure if the first line even works in PHP. Maybe if to say something like: if $homepage is not equal to nothing. I'm not sure. Any help would be appreciated. Thanks. hi php freaks, have link in a menu that looks like the following. I have been able search the string using strpos($lines[$i],'title='). What I want to know is how do I get the school summary into a variable. Code: [Select] <li><a href="../index.php" title="school summary">Summary</a></li> any help would be great Hi i need help with some string manipulation and extraction.. http://www.test.com/forums/attachment/f39/745d1267084199-official-ar-m16-m4-picture-thread-dsc00005.jpg I need to extract an id from the above path dynamically. I need to extract the digits before the alphabet d after the second last path f39/ In the above case the number extracted would be 745. Can someone please help me out with it? I have string like this (without the spaces) [ QUOTE="Adrock"]This is a test message[/QUOTE ] How do i get just what is between the double quotes taking into account in the message there could be double quotes? I've tried this but it doesn't echo anything unless i put the square brackets in but i want the username $origauth = html_entity_decode($message); $b = substr($origauth, strpos($origauth, '&#034') + 1); $c = substr($b, 0, strpos($b, '&#034')); echo $c; Hey there. Thinking this should be an easy one but I can only seem to find info on the string replace function. What I'm trying to do is strip everything after the @ from an email variable. So for example $mail variable comes in as me@gmail.com How would I strip the variable to only contain me and remove the @gmail.com I'll keep searching for the answer myself but if anyone can throw me a bone it's be appreciated. Cheers Hey guys! I found a flush function and it seems to be working well, but sometimes it will cut off characters. It's very strange. Here's my flush function: function out($str) { echo $str."<br />\n"; vbflush(); } function vbflush() { if (ob_get_length()){ @ob_flush(); @flush(); @ob_end_flush(); } @ob_start(); }And I'm calling it like this:out('Waiting 30 seconds until execution');And this is my output: Code: [Select] Waiting 30 seconds until executioAnyone know why? Hey guys I'm having an issue trying to get my PHP to display the first url of my exploded string and non of the others.
The SQL table column contains strings like this:
http://www.imgurl.com/image.jpg,http://www.imgurl.com/image2.jpg,http://www.imgurl.com/image3.jpg,http://www.imgurl.com/image4.jpg I have the following DOM document ( this is a sample document and is "as is", it's 100% intended to look like this ): <everything> <cars> <car>ladia</car> <car>ferrari</car> <garage>big blue building</garage> i also have a McLaren F1 but i wont brag about it </cars> <houses> <house>Big Red House</house> </houses> </everything> This is all being put into a $newdoc = new DOMDocument(); $myString = ................. ; // ????? I only want the content of <cars> in here, and without having the <cars> tag How can I make this "$myString look like the following: $myString = ' <car>ladia</car> <car>ferrari</car> <garage>big blue building</garage> i also have a McLaren F1 but i wont brag about it '; Preferably without any looping. Hello, I have several job categories on a recruitment website: $job_category[0]="accountant"; $job_category[1]="php programming"; $job_category[2]="baseball"; these job categories are contained within the urls imediately after the recruiting company's name and before the word "jobs", so we could have the following urls: www.url.com/company_name_accountant_jobs www.url.com/another_company_name_baseball_jobs www.url.com/yet_another_company_name_php programming_jobs Using the array $job_categories and the page path after the foward slash (e.g. yet_another_company_name_php programming_jobs) please could you tell me how to strip out the job category and the company name? (I'll extract the page path using a mod_rewrite) Thanks Stu Hi all, first time here as I am a bit stuck. I am by no means a programmer and I was hoping that someone out there may have a simple solution to my problem?... So here goes" I have a voucher/offers site up-and-running. The site content is generated from an external feed. I want to create other sites and I want to track what sales/clicks have come from where. An example of the feed: (http://www.awin1.com/awclick.php?mid=251&id=28971&clickref=[URL_REFERENCE]&p=http://www.247electrical.co.uk) As you will see, I have [URL_REFERENCE] in each link. I want to automatically change that part of the string in the database. Does anyone have any thoughts? The program is working for part of the data . It can display in the CSS and HTML code, however, the other data can not display . I do not why . They are same structure . Please tell me the reason. Thank you very much. Hi, I am using a PHP's preg_match() to search through string, and displaying its pattern, but want to display only part of it. E.g. looks like Code: [Select] preg_match('/shape=\'.*\'/sU',$value,$matches); The search displays " class='PHPfreaks' " From the search I would like to display only the part highlighted in bold. " '/shape=\'.*\'/sU' " So the final value to be displayed should be " PHPfreaks " Regards, Abhishek I have done this successfully in the past, but this time not working. I have 4 different html sections and I only want the individual section to display if a variable is set or is set to a specified term. But this code shows all of the sections no matter what, even though I'm using if() and elseif(). This code sample is the whole page, excuse the length, but only way to fix what I am doing wrong. <head> <?php require_once ('includes/auth.php'); require_once ('includes/config.php'); require_once ('includes/connect.php'); $action = $_POST['action']; $agencyid = $_POST['agencyid']; function clean($str) { $str = @trim($str); if (get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } if (isset($_POST['next1'])) { $fieldrep = clean($_POST['fieldrep']); $agencytype = clean($_POST['typeofagency']); $agencyent = clean($_POST['typeofent']); $exclusive = clean($_POST['exclusivity']); $capcarrier = clean($_POST['formcapt']); $contdate = clean($_POST['contdate']); $agencyname = clean($_POST['agencyname']); $physstr = clean($_POST['physstr']); $physcity = clean($_POST['physcity']); $physstate = clean($_POST['physstate']); $physzip = clean($_POST['physzip']); $physcount = clean($_POST['physcounty']); $mailstr = clean($_POST['mailstr']); $mailcity = clean($_POST['mailcity']); $mailstate = clean($_POST['mailstate']); $mailzip = clean($_POST['mailzip']); $mailcount = clean($_POST['mailcounty']); $fedtaxid = clean($_POST['fedtaxid']); $w9payto = clean($_POST['w9payto']); $agencylic = clean($_POST['agencylic']); $busphone = clean($_POST['bustele']); $busfax = clean($_POST['busfax']); $eandocar = clean($_POST['eocarrier']); $eandopolnum = clean($_POST['eopolnum']); $agencyemail = clean($_POST['agencyemail']); $website = clean($_POST['agencywebsite']); $car1name = clean($_POST['topcar1']); $car1prem = clean($_POST['topcardol1']); $car2name = clean($_POST['topcar2']); $car2prem = clean($_POST['topcardol2']); $car3name = clean($_POST['topcar3']); $car3prem = clean($_POST['topcardol3']); $car4name = clean($_POST['topcar4']); $car4prem = clean($_POST['topcardol4']); $car5name = clean($_POST['topcar5']); $car5prem = clean($_POST['topcardol5']); $perline = clean($_POST['perslineper']); $comline = clean($_POST['commlineper']); $lifeline = clean($_POST['lifelineper']); $sccar1 = clean($_POST['carrier1']); $sccar2 = clean($_POST['carrier2']); $sccar3 = clean($_POST['carrier3']); $sccar4 = clean($_POST['carrier4']); $sccar5 = clean($_POST['carrier5']); $choicepoint = clean($_POST['choicepoint']); $clientinfo = "INSERT INTO agency SET fieldrep = '$fieldrep', agencytype = '$agencytype', agencyent = '$agencyent', exclusive = '$exclusive', capcarrier = '$capcarrier', contdate = '$contdate', agencyname = '$agencyname', physstr = '$physstr', physcity = '$physcity', physstate = '$physstate', physzip = '$physcount', mailstr = '$mailstr', mailcity = '$mailcity', mailstate = '$mailstate', mailzip = '$mailzip', mailcount = '$mailcount', fedtaxid = '$fedtaxid', w9payto = '$w9payto', agencylic = '$agencylic', busphone = '$busphone', busfax = '$busfax', eandcar = '$eandcar', eandopolnum = '$eandopolnum', agencyemail = '$agencyemail', website = '$website', car1name = '$car1name', car1prem = '$car1prem', car2name = '$car2name', car2prem = '$car2prem', car3name = '$car3name', car3prem = '$car3prem', car4name = '$car4name', car4prem = '$car4prem', car5name = '$car5name', car5prem = '$car5prem', perline = '$perline', comline = '$comline', lifeline = '$lifeline', sccar1 = '$sccar1', sccar2 = '$sccar2', sccar3 = '$sccar3', sccar4 = '$sccar4', sccar5 = '$sccar5', choicepoint = '$choicepoint'"; $newclient = mysql_query($clientinfo) or die(mysql_error()); $agencyid = mysql_insert_id(); } if (isset($_POST['next2'])) { $name = clean($_POST['name']); $title = clean($_POST['emptype']); $ownership = clean($_POST['ownership']); $yrsins = clean($_POST['yrsins']); $profdesig = clean($_POST['profdesig']); $resstr = clean($_POST['resstr']); $rescity = clean($_POST['rescity']); $resstate = clean($_POST['resstate']); $reszip = clean($_POST['reszip']); $rescounty = clean($_POST['rescounty']); $social = clean($_POST['social']); $dob = clean($_POST['dob']); $tele = clean($_POST['tele']); $inslicense = clean($_POST['inslicense']); $emptype = clean($_POST['emptype']); $agencyid = clean($_POST['agencyid']); $empinsert = mysql_query("INSERT INTO employees SET name = '$name', title = '$title', ownership = '$ownership', yrsins = '$yrsins', profdesig = '$profdesig', resstr = '$resstr', rescity = '$rescity', resstate = '$resstate', reszip = '$reszip', rescounty = '$rescounty', social = '$social', dob = '$dob', tele = '$tele', inslicense = '$inslicense', emptype = '$emptype', agencyid = '$agencyid'")or die(mysql_error()); } if(isset($_POST['addemp'])) { $name = clean($_POST['name']); $title = clean($_POST['emptype']); $ownership = clean($_POST['ownership']); $yrsins = clean($_POST['yrsins']); $profdesig = clean($_POST['profdesig']); $resstr = clean($_POST['resstr']); $rescity = clean($_POST['rescity']); $resstate = clean($_POST['resstate']); $reszip = clean($_POST['reszip']); $rescounty = clean($_POST['rescounty']); $social = clean($_POST['social']); $dob = clean($_POST['dob']); $tele = clean($_POST['tele']); $inslicense = clean($_POST['inslicense']); $emptype = clean($_POST['emptype']); $agencyid = clean($_POST['agencyid']); $empinsert = mysql_query("INSERT INTO employees SET name = '$name', title = '$title', ownership = '$ownership', yrsins = '$yrsins', profdesig = '$profdesig', resstr = '$resstr', rescity = '$rescity', resstate = '$resstate', reszip = '$reszip', rescounty = '$rescounty', social = '$social', dob = '$dob', tele = '$tele', inslicense = '$inslicense', emptype = '$emptype', agencyid = '$agencyid'")or die(mysql_error()); } if (isset($_POST['submit'])) { $captive = clean($_POST['captive']); $mgastruc = clean($_POST['mgastruc']); $pastdue = clean($_POST['pastdue']); $suits = clean($_POST['suits']); $crimes = clean($_POST['crimes']); $suspensions = clean($_POST['suspensions']); $submitfinal = mysql_query("UPDATE agency SET captive = '$captive', mgastruc = '$mgastruc', pastdue = '$pastdue', suits = '$suits', crimes = '$crimes', suspensions = '$suspensions', completed = 'Yes' WHERE ID = '$agencyid'") or die(mysql_error()); } ?> </head> <body> <div id="containerfull"><!-- Use"containerfull" for 100% width. For fixed width, use "container980", "container760" or "container600" (the number is the layout width in pixels). --> <div id="header"> <h1><a href="http://www.yoursite.com/"><img width="400" height="100" src="images/logo.jpg" /></a></h1> </div> <div id="menu"> <ul> <li><a href="index.html">Home</a></li> <li><a class="current" href="signup.html">Signup a Producer</a></li> </ul> </div> <?php if (isset($_POST['next1'])) { ?> <div id="main"> <div id="containerfull"> <h3>D. Employee Information</h3> <table> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <p> <tr> <td>Owner Name</td><td colspan="9"><input type="text" size="50" maxlength="75" name="name" tabindex="1" /></td> </tr> <tr> <td>Employee Type</td><td><select size="1" name="emptype" tabindex="2"> <option value="Owner">Owner</option> <option value="Employee">Employee</option> </select></td> </tr> <tr> <td>% Ownership</td><td> </td><td><input type="text" size="3" maxlength="3" name="ownership" tabindex="2" /></td><td> </td><td>Years In Insurance</td><td><input type="text" size="3" maxlength="3" name="yrsins" tabindex="3" /></td><td> </td><td>Professional Designations</td><td><input type="text" size="25" maxlength="50" name="profdesig" tabindex="4" /></td> </tr> <tr> <td>Resident Address</td><td colspan="8"><input type="text" size="50" maxlength="75" name="resstr" tabindex="5" /></td> </tr> <tr> <td> </td><td>City</td><td><input type="text" size="20" maxlength="45" name="rescity" tabindex="6" /></td><td>State</td> <td> <select tabindex="6" name="resstate" size="1" tabindex="10"> <option value="AL">AL</option> <option value="AK">AK</option> <option value="AZ">AZ</option> <option value="AR">AR</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DE">DE</option> <option value="DC">DC</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="HI">HI</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="IA">IA</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="ME">ME</option> <option value="MD">MD</option> <option value="MA">MA</option> <option value="MI">MI</option> <option value="MN">MN</option> <option value="MS">MS</option> <option value="MO">MO</option> <option value="MT">MT</option> <option value="NE">NE</option> <option value="NV">NV</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NY">NY</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VT">VT</option> <option value="VA">VA</option> <option value="WA">WA</option> <option value="WV">WV</option> <option value="WI">WI</option> <option value="WY">WY</option> </select> </td><td>Zip</td><td><input type="text" size="10" maxlength="10" name="reszip" tabindex="8" /></td><td>County</td><td><input type="text" size="25" maxlength="45" name="rescounty" tabindex="9" /></td> </tr> <tr> <td>Social Security #</td><td><input type="text" size="11" maxlength="11" name="social" tabindex="10" /></td><td> </td><td>Date Of Birth</td><td><input type="text" size="10" maxlength="10" name="dob" tabindex="11" /></td><td>Home Telephone</td><td><input type="text" size="12" maxlength="12" name="tele" tabindex="12" /></td> </tr> <input type="hidden" value="<?php echo $agencyid; ?>" name="agencyid" /> <input type="hidden" value="addemp" name="action" /> <tr> <td><input type="submit" value="Add Employee" name="addemp" tabindex="12" /></td><td><input type="submit" value="Next" name="next2" tabindex="13" /></td> </tr> </form> </table> <?php } elseif (isset($_POST['next2'])) { ?> <div id="main"> <div id="containerfull"> <h3>F. Questions</h3> <table> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <tr> <td>1. Is agent/agency affiliated with ANY captive entity or carrier?</td><td><select size="1" name="captive" tabindex="1"> <option value="No">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>2. Is agent/agency affiliated with ANY MGA structure?</td><td><select size="1" name="mgastruc" tabindex="2"> <option value="No">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>3. Any account current or unearned commission balances past due to any company?</td><td><select size="1" name="pastdue" tabindex="3"> <option value="No">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>4. Any judgements or suits pending against the Agency?</td><td><select size="1" name="suits" tabindex="4"> <option value="No">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>5. Have you or anyone in your Agency ever been convicted of a felony crime in any state or federal court?</td><td><select size="1" name="crimes" tabindex="5"> <option value="No">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>6. Any license suspensions in the past five years?</td><td><select size="1" name="suspensions" tabindex="6"> <option value="No">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td><label for="explainyes">Explain any yes answers:</label><textarea cols="60" rows="10" wrap="VIRTUAL" maxlength="1000" name="explainyes" tabindex="7"></textarea></td> </tr> <tr> <td><h3>G. Checklist (Please include the following paperwork when submitting to corporate office)</h3></td> </tr> <input type="hidden" value="submit" name="action" /> <input type="hidden" value="<?php echo $agencyid; ?>" name="agencyid" /> <tr> <td><input type="submit" value="Submit" name="submit" tabindex="8" /></td> </tr> </form> </table> <?php } elseif (isset($_POST['adduser'])) { ?> <div id="containerfull"> <div class="left"> <p> <table> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <tr> <td>Employee List</td> </tr> <?php $emplistquery = mysql_query("SELECT * FROM employees WHERE agencyid = '$agencyid'") or die(mysql_error()); while ($emplist = mysql_fetch_array($emplistquery)) { ?> <tr> <td>Name:</td><td><?php echo $emplist['name']; ?></td><td>Title:</td><td><?php echo $emplist['title']; ?></td> </tr> <?php } ?> </table> </p> </div> <div class="clear"> </div> </div> <div id="main"> <div id="containerfull"> <h3>D. Employee Information</h3> <table> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <p> <tr> <td>Owner Name</td><td colspan="9"><input type="text" size="50" maxlength="75" name="name" tabindex="1" /></td> </tr> <tr> <td>Employee Type</td><td><select size="1" name="emptype" tabindex="2"> <option value="Owner">Owner</option> <option value="Employee">Employee</option> </select></td> </tr> <tr> <td>% Ownership</td><td> </td><td><input type="text" size="3" maxlength="3" name="ownership" tabindex="2" /></td><td> </td><td>Years In Insurance</td><td><input type="text" size="3" maxlength="3" name="yrsins" tabindex="3" /></td><td> </td><td>Professional Designations</td><td><input type="text" size="25" maxlength="50" name="profdesig" tabindex="4" /></td> </tr> <tr> <td>Resident Address</td><td colspan="8"><input type="text" size="50" maxlength="75" name="resstr" tabindex="5" /></td> </tr> <tr> <td> </td><td>City</td><td><input type="text" size="20" maxlength="45" name="rescity" tabindex="6" /></td><td>State</td> <td> <select tabindex="6" name="resstate" size="1" tabindex="10"> <option value="AL">AL</option> <option value="AK">AK</option> <option value="AZ">AZ</option> <option value="AR">AR</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DE">DE</option> <option value="DC">DC</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="HI">HI</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="IA">IA</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="ME">ME</option> <option value="MD">MD</option> <option value="MA">MA</option> <option value="MI">MI</option> <option value="MN">MN</option> <option value="MS">MS</option> <option value="MO">MO</option> <option value="MT">MT</option> <option value="NE">NE</option> <option value="NV">NV</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NY">NY</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VT">VT</option> <option value="VA">VA</option> <option value="WA">WA</option> <option value="WV">WV</option> <option value="WI">WI</option> <option value="WY">WY</option> </select> </td><td>Zip</td><td><input type="text" size="10" maxlength="10" name="reszip" tabindex="8" /></td><td>County</td><td><input type="text" size="25" maxlength="45" name="rescounty" tabindex="9" /></td> </tr> <tr> <td>Social Security #</td><td><input type="text" size="11" maxlength="11" name="social" tabindex="10" /></td><td> </td><td>Date Of Birth</td><td><input type="text" size="10" maxlength="10" name="dob" tabindex="11" /></td><td>Home Telephone</td><td><input type="text" size="12" maxlength="12" name="tele" tabindex="12" /></td> </tr> <input type="hidden" value="<?php echo $agencyid; ?>" name="agencyid" /> <td><input type="submit" value="Cancel & Next" name="next2" tabindex="12"/></td><td><input type="submit" value="Add Employee" name="addemp" tabindex="13" /></td><td><input type="submit" value="Next" name="next2" tabindex="14" /></td> </form> </table> <?php } elseif (isset($_POST['submit'])) { ?> <table> <form action="print.php" method="POST"> <tr> <td>Information Submitted</td> </tr> <tr> <td>Print</td><td><select size="1" name="printname" tabindex="1"> <option value="Application">Application</option> <option value="Agreement">Agreement</option></td> </tr> <input type="hidden" value="<?php echo $agencyid; ?>" name="agencyid" /> <input type="hidden" value="submit" name="action" /> <tr> <td><input type="submit" value="Print" name="print" tabindex="2" /></td> </tr> </form> </table> <?php } else { ?> <div id="feature"> <div class="left"> <p> <table> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <tr> <td>Field Rep:</td><td><input type="text" size="25" maxlength="40" name="fieldrep" tabindex="1" /></td> </tr> <tr> <td>Type of Agency:</td><td><input type="text" size="25" maxlength="40" name="typeofagency" tabindex="2" /></td> </tr> <tr> <td>Type of Entity:</td><td><input type="text" size="25" maxlength="40" name="typeofent" tabindex="3" /></td> </tr> </table> </p> </div> <div class="right"> <p> <table> <tr> <td align="right">Exclusivity:</td><td><input type="text" size="25" maxlength="40" name="exclusivity" tabindex="4" /></td> </tr> <tr> <td align="right">Former Captive Carrier:</td><td><input type="text" size="25" maxlength="40" name="formcapt" tabindex="5" /></td> </tr> <tr> <td align="right">Contract Date:</td><td><input type="text" size="25" maxlength="40" name="contdate" tabindex="6" /></td> </tr> </table> </p> </div> <div class="clear"> </div> </div> <div id="main"> <div id="containerfull"> <h3>A. Agency Information</h3> <p> <table> <tr> <td>Agency Name</td><td colspan="4"><input name="agencyname" type="text" size="65" maxlength="65" tabindex="6" /></td> </tr> <tr> <td>Physical Address</td><td colspan="2"><input type="text" size="25" maxlength="50" name="physstr" tabindex="7" /></td><td>City</td><td><input type="text" size="25" maxlength="40" name="physcity" tabindex="7" /></td> </tr> <tr> <td> </td><td>State</td><td> <select tabindex="6" name="physstate" size="1" tabindex="8"> <option value="AL">AL</option> <option value="AK">AK</option> <option value="AZ">AZ</option> <option value="AR">AR</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DE">DE</option> <option value="DC">DC</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="HI">HI</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="IA">IA</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="ME">ME</option> <option value="MD">MD</option> <option value="MA">MA</option> <option value="MI">MI</option> <option value="MN">MN</option> <option value="MS">MS</option> <option value="MO">MO</option> <option value="MT">MT</option> <option value="NE">NE</option> <option value="NV">NV</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NY">NY</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VT">VT</option> <option value="VA">VA</option> <option value="WA">WA</option> <option value="WV">WV</option> <option value="WI">WI</option> <option value="WY">WY</option> </select></td><td>Zip</td><td><input type="text" size="5" maxlength="10" name="physzip" tabindex="9" /></td><td>County</td><td><input type="text" size="20" maxlength="40" name="physcounty" tabindex="10" /></td> </tr> <tr> <td>Mailing Address</td><td colspan="2"><input type="text" size="25" maxlength="50" name="mailstr" tabindex="7" /></td><td>City</td><td><input type="text" size="25" maxlength="40" name="mailcity" tabindex="7" /></td> </tr> <tr> <td> </td><td>State</td><td> <select tabindex="6" name="mailstate" size="1" tabindex="8"> <option value="AL">AL</option> <option value="AK">AK</option> <option value="AZ">AZ</option> <option value="AR">AR</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DE">DE</option> <option value="DC">DC</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="HI">HI</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="IA">IA</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="ME">ME</option> <option value="MD">MD</option> <option value="MA">MA</option> <option value="MI">MI</option> <option value="MN">MN</option> <option value="MS">MS</option> <option value="MO">MO</option> <option value="MT">MT</option> <option value="NE">NE</option> <option value="NV">NV</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NY">NY</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VT">VT</option> <option value="VA">VA</option> <option value="WA">WA</option> <option value="WV">WV</option> <option value="WI">WI</option> <option value="WY">WY</option> </select></td><td>Zip</td><td><input type="text" size="5" maxlength="10" name="mailzip" tabindex="9" /></td><td>County</td><td><input type="text" size="20" maxlength="40" name="mailcounty" tabindex="10" /></td> </tr> <tr> <td>Federal Tax ID</td><td colspan="2"><input type="text" size="11" maxlength="11" name="fedtaxid" tabindex="11" />(99-9999999)</td><td>W9 Pay to Name</td><td colspan="2"><input type="text" size="25" maxlength="40" name="w9payto" tabindex="12" /></td> </tr> <tr> <td>Agency License Number</td><td><input type="text" size="15" maxlength="15" name="agencylic" /></td> </tr> <tr> <td>Business Telephone</td><td colspan="2"><input type="text" size="25" maxlength="25" name="bustele" tabindex="13" /></td><td>Business Fax</td><td><input type="text" size="25" maxlength="25" name="busfax" tabindex="14" /></td> </tr> <tr> <td>E&O Carrier</td><td colspan="2"><input type="text" size="25" maxlength="50" name="eocarrier" tabindex="14" /></td><td>Policy #</td><td colspan="2"><input type="text" size="25" maxlength="40" name="eopolnum" tabindex="15" /></td> </tr> <tr> <td>Agency Email Address</td><td colspan="4"><input type="text" size="40" maxlength="50" name="agencyemail" tabindex="16" /></td> </tr> <tr> <td>Website Address</td><td colspan="4"><input type="text" size="60" maxlength="75" name="agencywebsite" tabindex="17" /></td> </tr> <tr> <td colspan="10"><h3>B. Top 5 Carriers You Represent Now, Include Premium</h3></td> </tr> <tr> <td colspan="2">1. <input type="text" size="30" maxlength="45" name="topcar1" tabindex="18" /></td><td colspan="2">$ <input type="text" size="30" maxlength="45" name="topcardol1" tabindex="19" /></td> </tr> <tr> <td colspan="2">2. <input type="text" size="30" maxlength="45" name="topcar2" tabindex="20" /></td><td colspan="2">$ <input type="text" size="30" maxlength="45" name="topcardol2" tabindex="21" /></td> </tr> <tr> <td colspan="2">3. <input type="text" size="30" maxlength="45" name="topcar3" tabindex="22" /></td><td colspan="2">$ <input type="text" size="30" maxlength="45" name="topcardol3" tabindex="23" /></td> </tr> <tr> <td colspan="2">4. <input type="text" size="30" maxlength="45" name="topcar4" tabindex="24" /></td><td colspan="2">$ <input type="text" size="30" maxlength="45" name="topcardol4" tabindex="25" /></td> </tr> <tr> <td colspan="2">5. <input type="text" size="30" maxlength="45" name="topcar5" tabindex="26" /></td><td colspan="2">$ <input type="text" size="30" maxlength="45" name="topcardol5" tabindex="27" /></td> </tr> <tr> <td colspan="10"><h3>Percentage of Business Written</h3></td> </tr> <tr> <td align="right">Personal Lines</td><td>%<input type="text" size="3" maxlength="3" name="perslineper" tabindex="28" /></td><td align="right">Commercial Lines</td><td>%<input type="text" size="3" maxlength="3" name="commlineper" tabindex="29" /></td><td align="right">Life/Health</td><td>%<input type="text" size="3" maxlength="3" name="lifelineper" tabindex="30" /></td> </tr> <tr> <td colspan="10"><h3>C. Carriers to be provided through</h3></td> </tr> <tr> <td colspan="10">1.<select size="1" name="carrier1" tabindex="31"> </select></td> </tr> <tr> <td colspan="10">2.<select size="1" name="carrier2" tabindex="32"> <option selected="selected"></option> </select></td> </tr> <tr> <td colspan="10">3.<select size="1" name="carrier3" tabindex="33"> <option selected="selected"></option> </select></td> </tr> <tr> <td colspan="10">4.<select size="1" name="carrier4" tabindex="34"> <option selected="selected"></option> </select></td> </tr> <tr> <td colspan="10">5.<select size="1" name="carrier5" tabindex="35"> <option selected="selected"></option> </select></td> <tr> <td colspan="10"><h3>ChoicePoint Node ID</h3><input type="text" size="40" maxlength="40" name="choicepoint" tabindex="36" /></td> </tr> </tr> <tr><td><input type="submit" value="Next" name="next1" tabindex="37" /></td></tr> </table> <?php } ?> </p> <div class="clear"> </div> </div> <div class="clear"> </div> </div> Can someone show me the correct code to display a group of checkbox values as part of an if statement? For example: in Programme One, lesson 100, lesson 310 and lesson 102 are available. In Programme Two, lesson 302, lesson 201, and lesson 102 are available. The "lesson types" are a checkbox group. I need to output the lesson types depending on whether they are part of Programme One or Two, along with other variables such as instructor student ratio. I put the following code together where field_lessons is the checkbox group; <?php if ($fieldsObjects['field_type']->data == "Programme One") { print '<p class="details_heading03">Instructor Student Ratio</p>'; echo $fieldsFormatted['field_student_ratio']. '<br />'; foreach ($fieldsObjects['field_lessons']->data as $name => $value) { echo $value; echo "<br/>"; } else { echo "no"; } ?> I have also tried using this statement: <?php if ($fieldsObjects['field_type']->data == "Programme One") { print '<p class="details_heading03">Instructor Student Ratio</p>'; echo $fieldsFormatted['field_student_ratio']. '<br />'; echo (isset($fieldsObjects['field_lessons']->data) && is_array($fieldsObjects['field_lessons']->data)) ? } else { echo "no"; } ?> I am new to php, and I am customising a template which is part of Sobi2, which has been installed as a component of Joomla! (CMS)? Thank you jo My query gets the results and orders by one of the fields. Once I get the MySQL results I would like to find the first entry that has a letter as the first character of the same field that the list was ordered by, then split the results in to two parts and swap them. So that the results that have a letter at the start of the same sorted field are as the begining and the results that have the numbers as the start at the end of the array. But also so that the array works the same way as the original results string, so i can use say $results['mysqlfield'] Code: [Select] <? $out = preg_replace('/^(.{701}[^.]*).*/i','$1.',$detrsltnewsrow[news_desc]); echo $out; ?> </td></tr><tr><td colspan="2" class="para" style="padding-left:10px;"> <?= substr(stripslashes(trim($detrsltnewsrow[news_desc])),701) ?> </td></tr> I have the above snippet.. The first php statement, basically grasp the first 701 characters with the closet next stop "." character and out puts it. then out puts the HTML tags I have a problem with the second statement. I want to output anything after what has been outputted by: Code: [Select] <? $out = preg_replace('/^(.{701}[^.]*).*/i','$1.',$detrsltnewsrow[news_desc]); echo $out; ?> So need the correct syntax for Code: [Select] <?= substr(stripslashes(trim($detrsltnewsrow[news_desc])),701) ?> Currently it breaks at exactly the 701 character, want it to continue from the sentence the first code ended in. I have a string, and I have a variable $var = 5; $str = '<img src="img.jpg" />'; i want to display a $str (the image) $var amount of times (5). how can I do this? |