PHP - Help Generating A Dynamic Variable Name
OK, what I am trying to do is generate a dynamic variable name.
I want to setup a foreach statement that will generate variable names based on an array of data. $numbers = array('one', 'two', 'three', 'four', 'five', 'six', 'seven'); foreach ($numbers as $number) { } What I need, is for a bunch of variables to be generated and filled with content. $variable_one_label = "Blah"; $variable_two_label = "Blah Again"; How can I generate the dynamic variable based on the array value? Similar TutorialsHi guys, Just a quick one - this is more of a bit of a challenge than a problem! I'm pretty good with PHP - I'm definitely not a beginner, but I've come across a problem I've not yet been able to solve satisfactorily. Essentially, I am trying to write a really good, solid OOP library that I can hand out for people to use for CMS-driven websites, and I want to literally just upload some files and have access to some variables... simple enough. But, my snagging point came when I was writing the image library, which handles uploading files and moving them from place to place. These functions as you know usually require an absolute server path - not a relative path and certainly not a URL, so I wanted to place something in my config file that gets the base URL, puts the relative path in one variable (e.g. mysite.com/directory would give /directory) and the server path in another (e.g. mysite.com/directory might give var/www/mysite/www/directory). Now I might just be being foolish and overlooking something, but I've used HTTP_HOST, DOCUMENT_ROOT etc to get this information, but I only want to get the base directory that the application resides in - usually with installed software sure as WordPress you have to specify which directory the files are going to sit in, which I wondered if you could gauge automatically? Any help would be appreciated - I've tried as many clever approaches as I could think of, and the only one I can think of now is setting the variables based on, say, installtion.php since I know the name of the file and where it resides, I can strip out all folders minus the filename, which would give me the root directory, but that seems a little fiddly to me? Someone must have done this before and have a nice clean solution to the problem? I'm at a loss anyway, and I figured it might be a fair challenge to do? Thanks, Luke Hi, I'm trying to make a dynamic html table to contain the mysql data that is generated via php. I'm trying to display a user's friends in a table of two columns and however many rows, but can't seem to figure out what is needed to make this work. Here's my code as it stands: Code: [Select] <?php //Begin mysql query $sql = "SELECT * FROM friends WHERE username = '{$_GET['username']}' AND status = 'Active' ORDER BY friends_with ASC"; $result = mysql_query($sql); $count = mysql_num_rows($result); $sql_2 = "SELECT * FROM friends WHERE friends_with = '{$_GET['username']}' AND status = 'Active' ORDER BY username ASC"; $result_2 = mysql_query($sql_2); $count_2 = mysql_num_rows($result_2); while ($row = mysql_fetch_array($result)) { echo $row["friendswith"] . "<br>"; } while ($row_2 = mysql_fetch_array($result_2)) { echo $row_2["username"] . "<br>"; } ?> The above simply outputs all records of a user's friends (their usernames) in alphabetical order. The question of how I'd generate a new row each time a certain amount of columns have been met, however, is beyond me. Anyone know of any helpful resources that may solve my problem? Thanks in advance =) I have this as my autoloader. All the classes are based off of Class O. I wanted to be able to do something like $dog = new Dog(); even if I hadn't yet created Dog.class.php and made it extend O. (I realize there are plenty of reasons this is a bad idea, this is a temporary part of the project, I am just trying to get a few things set up and thought it would work - now I'm probably going to spend more time trying to do this than it would have saved, but I'm curious. ) ( ! ) Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING in C:\wamp\www\project\index.php on line 22 (line 22 is Class $class_name extends O{ Code: [Select] <?php function autoload($class_name) { if(file_exists($class_name.'.class.php')){ require_once($class_name.'.class.php'); }else{ Class $class_name extends O{ } } } ?> Is it possible to do what I'm trying to do? Friends I am new to php and i have to submit my coursework in php by 3rd dec, I stuck at one place where i have to upload multiple photo and one can see all the photo he has uploaded and can edit or delete that photo so i have done uploading now i am showing those pics in table by running loop and generating tr and td but now i have two buttons with each row edit and delete now when i clicked on one delete or edit that pic should be delete or give text box to edit description of pic, Please help me how to do that....... Hello. I want to create some variables dynamically. I have this so far: for($i = 1; $i <= 4 ; $i++){ $a = 'member' . $i; $$a = array(); } Does that give me this 4 arrays?: $member1, $member2, $member3 and $member4? Of course I want some process inside of the loop, but that would depend on the variables. Would that work? thanks! hi guys I just could not find the answer on forum. I have a url like this http://www.example.com/deal.php?id=367 and my question is : how can i use curl function to get the html and the id value which is 367 thanks I have a form that inserts information into a mysql, the only prolem is I need to add different surrounding html to the information when entering it into the database depending what the value is...(essentially I want to store font color around different levels) How would I define the same variable with different information depending on the value? The information is called using: if ($_SERVER['REQUEST_METHOD'] == 'POST') { $editLEVEL=$_POST['level']; I want it so if 'Level1' is the posted value then $editLEVEL would be '<color=1>$editLEVEL</color>' but if 'Level2' is the posted value the $editLEVEL would be '<color=2>$editLEVEL</color>' If you dont understand just let me know I'll try explain best I can. Hi ! I'd like to count all occurences in "$thiscodestring" into a "dynamic?" array and print it out after the end of the loop, how do I assign the variablenames dynamically ? $query = "SELECT codes, status FROM table"; while ($row = mysql_fetch_assoc($result)) { $thiscodestring = $row[codes]; // looks like "a1 c2 d3 10 15 1 a1 a1"; $singlecodes = explode(" ", $thiscodestring); foreach($singlecodes as $thiscode) { $$thiscode[count] = $$thiscode[count] + 1; } } After all Mysql-Stuff is done I'd like to print out the counted codes, for example the code "a1" was found 100 times in all querys then $$a1[count] should be 100, c2 was found 15 times, then $$c2[count] should be 15 and so on. Question: How do I tell php to assign a "dynamic" variable with the name of the found string which was exploded (in this example a1, c2, d3... ) before ?! $$ does not seem to work. And how can I then print_r() the value if I dont know the name ? Thanks ! <?php $foo = 5; $too = 7; ${"foo"}++; ${"too"}++; echo $foo; echo '<br />' . $too; $my_var_name = "foo"; ${$my_var_name}++; echo $foo; ?> I understand the part that $my_var_name is going to increment $foo. But I don't understand that when we used ${"foo"} we did not add the $ sign with it. But when we use ${$my_var_name} we have to add another $ sign. why is that? Hello, I'm working on a dynamic text form (I guess thats what its called). Basically, I have a html page that echos in some PHP code. What the PHP code does is show different strings of text depending on a variable: Code: [Select] <PHP? $brief1_info = "brief info goes here"; $brief1 = 0; if (isset($_POST['brief1Go'])) { $brief1 = $brief1 + 1; } else if (isset($_POST['brief1Back'])) { $brief1 = $brief1 - 1; } $breif1Controller = " <form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\"> <input type=\"submit\" name=\"brief1Back\" id=\"brief1Back\" value=\"BACK\" /> </form> <form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\"> <input type=\"submit\" name=\"brief1Go\" id=\"brief1Go\" value=\"CONTINUE\" /> </form>"; if($brief1 == 0){ $brief1_info = "<b>Welcome Commander,</b> you are currently viewing the Mission Control Brief page, here you can view all your missions that you need to complete in order to advance through your prestiges. You will need to follow your briefs carefully in order to succeed. <br /><br /> "; } else if($brief1 == 1){ $brief1_info = "Okay, let me show you around the place ..."; } else if($brief1 == 2){ $brief1_info = "brief is on 2"; } ?> The problem is, the BACK and CONTINUE buttons don't work. If $brief1 equals 0, and the user presses continue, the is should go to 1, and the brief1_info string is changed (so some different text shows in my html). It actually works when brief1 is on '0', but when its on 1 and the user pressed continue, the brief1 is changed to 1, but because the submit button refreshes the page, the variable is re-read again, and thus is reset back to 0. Is there a way around this? Or is there a better method than what I'm doing? Thanks Hi I'm trying the following code: Code: [Select] $t = '12<-- AB_C -->'; $AB_C = 'abc'; echo preg_replace('/\<-- ([A-Z_]+) --\>/', "$$1", $t);I want to get "12abc" , but it outputs: 12$AB_C , so, it not recognize the replacement as dynamic variable. Is it any way to use the matched word in preg_replace() as a variable, or dynamic variable? Hi all, here's my code: Code: [Select] <?php foreach ($_SESSION['topping'] as $value) { echo "<tr><td width='30%'>Topping</td><td width='50%'>$value</td><td width='20%'><select name='notopping'>"; foreach ($_SESSION['cupcake'] as $number) { '<option name="notoppings[]" value="'.$number.'">".$number."</option>'; } echo "</select></td></tr>"; } ?> $_SESSION['cupcake'] is a value from either 6, 12, 24 or 36. What I want to do is put them into a drop down box (second foreach) as the value and the displayed value - counting up from 1 (so 1,2,3,4,5,6 or up to 12,24 etc). Also by creating this as an array, does this mean than for each topping (say Vanilla and Chocolate) the value dynamically created can be used on the next page by using $_POST['notoppings'] to display each type (two different numbers - one for Vanilla and one for Chocolate). Does that make sense? Thanks! Jason Folks, I need help (Php code ) to generate a Dynamic Text on a Base Image. What i want to do is, to make this Image as header on my Site and to make this Header Specific to a Site, i want to Add the Domain Name on the Lower Left of the Image. Got the Idea? Here is the Image link: Quote http://img27.imageshack.us/i/shoppingheader1.jpg/ PHP Variable that holds the Domain name is: $domain All i need the Dynamic PHP Codes that i can put on all my sites to generate this Text on Image (Header) Dynamically... May Anyone Help me with this Please? Cheers Natasha T. There is a section in my site in which i will need to give the user 3 options: Generate Specific User Text As: 1. pdf 2. .doc 3. .txt 4. print in html The 4th option is simple. The other three are completely new to me. I know little bit about fopen, fwrite and fclose, however these are commands that write files to the server. I need to write files to the users computer. Is the best way for this to be: 1. the user clicks .txt 2. the .txt is written to the server 3. the .txt is then downloaded to the users computer by the user 4. the .txt is then deleted from the server All 4 steps to be done with one click from the user. Might there not be traffic problems if lots and lots of users are doing this at the same time? Any pushes in right direction here would be great, there seems to be hundreds of sites saying different solutions Hi, I've written some code to take information from an SQL database and write it out in the RSS format (Although it doesn't validate). The problem is i'd like the page to have the .rss (or .xml) file extension, I'm not sure if there's any advantages in having this but thought i'd ask. I've got the following code: Code: [Select] <?php header('Content-type: text/xml'); print '<?xml version="1.0"?>'; print '<rss version="2.0">'; print '<channel>'; include("phpfunctions.php"); db_connect(); //select all from users table $select="SELECT title, link, description FROM news"; $result = mysql_query($select) or die(mysql_error()); //If nothing is returned display error no records if (mysql_num_rows($result) < 1) { die("No records"); } //loop through the results and write each as a new item while ($row = mysql_fetch_assoc($result)) { $item_title = $row["title"]; $item_link = $row["link"]; $item_desc = $row["description"]; print '<item>'; print '<title>' . $item_title . '</title>'; print '<link>' . $item_link . '</link>'; print '<description>' . $item_desc . '</description>'; print '</item>'; } print '</channel>'; print '</rss>'; ?> This seems to work fine as i get what i expect and i'm assuming i can do the same to output .xml but is there a way to have it in a proper .rss / .xml file so that an aggregator or someone could read this properly. Cheers, Reece Hi All - I wanted to know if there is any existing script to generate an eticket when a user books a ticket through a website. Thanks hi guys, im trying to resize and save a thumbnail version of images uploaded to my site in a sub folder (thumbs). I've currently got: $image=imagecreatefromjpeg($filepath); list($width, $height) = getimagesize($filepath); $new_width = 200; $new_height= 150; $image_p=imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Save the image imagejpeg($image_p, '/thumbs'.$filepath); // Free up memory imagedestroy($image_p); but it appears to do nothing, but it also doesn't return any errors? could someone help me out please? thanks! Does anyone know of a free php library to create pdf417 2d barcodes? As a complete newbie, I'm not sure Ive got the terminology right in my subject header. But this is what I am trying to do. I have a soccer stats site with data entered into each of numerous 'seasons', accessible via a drop-down menu, as he http://www.fleethistory.co.uk/stats/matches.php Now regardless of what season I select, the URL will stay the same as above. What I want to do is have users go direct to a particular season from a link without having to use the drop-down. How would I generate a unique URL for each of the seasons listed in the drop-down? Don't know if you need the PHP code, but here it is just in case: Code: [Select] <?php /* *************************************************************************** * tplSoccerStats * ----------------------------------------------------------------------- * Copyright: TPL Design * email: info@tpl-design.com * www: www.tpl-design.com/tplsoccerstats *************************************************************************** */ // Starts a new session or resumes the current one. session_start(); // Get db host, db username, db password, and db name from admin/user.php // (each team has its own db). include('admin/user.php'); // Establish db connection. Select appropriate team db. $connection = mysql_connect("$host", "$user", "$password") or die(mysql_error()); mysql_select_db("$txt_db_name", $connection) or die(mysql_error()); // Get preferences stored in db. $sql = "SELECT * FROM tplss_preferences WHERE ID = '0'"; $pref = mysql_query($sql, $connection) or die(mysql_error()); $pdata = mysql_fetch_array($pref); mysql_free_result($pref); // Include php preferences. include('preferences.inc'); // Use session defaults if available, otherwise set them from database values. if ((!isSet($_SESSION['defaultseasonid_tplss'])) || (!isSet($_SESSION['defaultmatchtypeid_tplss'])) || (!isSet($_SESSION['defaultlanguage_tplss']))) { $_SESSION['defaultseasonid_tplss'] = $pdata['DefaultSeasonID']; $_SESSION['defaultmatchtypeid_tplss'] = $pdata['DefaultMatchTypeID']; $_SESSION['defaultlanguage_tplss'] = $pdata['DefaultLanguage']; } $defaultseasonid = $_SESSION['defaultseasonid_tplss']; $defaultmatchtypeid = $_SESSION['defaultmatchtypeid_tplss']; $defaultlanguage = $_SESSION['defaultlanguage_tplss']; // Include language based global vars, in our case english, e.g. $txt_preview = 'Preview' include('language.inc'); // Include pafc banner and menu bar. include('header.php'); // Start an html form. echo '<form method="post" action="change.php">' . "\n"; // Print images at top of form if we have them (we don't). $image_url = "images/header.jpg"; $image_url2 = "images/header.gif"; if(file_exists($image_url) || file_exists($image_url2)) { echo '<table align="center" width="' . $tb_width . '" cellspacing="0" cellpadding="0" border="0">' . "\n"; echo "<tr>\n"; echo '<td align="center">' . "\n"; if (file_exists($image_url)) { echo '<img src="' . $image_url . '" ALT=""><br>' . "\n"; } elseif (file_exists($image_url2)) { echo '<img src="' . $image_url2 . '" ALT="">' . "\n"; } echo "</td></tr></table>\n\n"; } ?> <!-- Print change bar table --> <table align="center" width="<?php echo $tb_width ?>" cellspacing="0" cellpadding="0" border="0" bgcolor="<?php echo $border_c ?>"> <tr> <td> <table width="100%" cellspacing="1" cellpadding="5" border="0"> <tr> <td bgcolor="<?php echo $inside_c ?>" align="center"> <?= $txt_change ?>: <select name="season"> <option value="0"><?= $txt_all ?></option> <?php $sql = "SELECT * FROM tplss_seasonnames WHERE SeasonPublish = '1' ORDER BY SeasonName DESC"; $get_seasons = mysql_query($sql, $connection) or die(mysql_error()); while($data = mysql_fetch_array($get_seasons)) { if($data['SeasonID'] == $defaultseasonid) echo '<option value="' . $data['SeasonID'] . '" SELECTED>' . $data['SeasonName'] . "</option>\n"; else echo '<option value="' . $data['SeasonID'] . '">' . $data['SeasonName'] . "</option>\n"; } mysql_free_result($get_seasons); ?> </select> or Competition: <select name="matchtype"> <option value="0"><?= $txt_all ?></option> <?php $sql = "SELECT * FROM tplss_matchtypes ORDER BY MatchTypeName"; $get_types = mysql_query($sql, $connection) or die(mysql_error()); while($data = mysql_fetch_array($get_types)) { if($data['MatchTypeID'] == $defaultmatchtypeid) echo '<option value="' . $data['MatchTypeID'] . '" SELECTED>' . $data['MatchTypeName'] . "</option>\n"; else echo '<option value="' . $data['MatchTypeID'] . '">' . $data['MatchTypeName'] . "</option>\n"; } mysql_free_result($get_types); ?> </select> <input type="submit" name="submit" value="Select"> </td> </tr> </table> </td> </tr> </table> <!-- Print outer fixture tables --> <table align="center" width="<?php echo $tb_width ?>" cellspacing="0" cellpadding="0" border="0" bgcolor="<?php echo $border_c ?>"> <tr> <td> <table width="100%" cellspacing="1" cellpadding="5" border="0"> <tr> <td bgcolor="<?php echo $inside_c ?>" align="center"> <!-- Print inner fixture table --> <table width="<?= $tb2_width ?>%" cellspacing="0" cellpadding="4" border="0"> <tr> <td align="left" valign="middle" bgcolor="#D01818"> <font color="#FFffff"><b>Date</b></font> </td> <td align="center" valign="middle" bgcolor="#D01818"> <font color="#FFffff"><b>H/A</b></font> </td> <td align="left" valign="middle" bgcolor="#D01818"> <font color="#FFffff"><b>Opponent</b></font> </td> <td align="left" valign="middle" bgcolor="#D01818"> <font color="#FFffff"><b>Competition</b></font> </td> <td align="center" valign="middle" bgcolor="#D01818" colspan="2"> <font color="#FFffff"><b>Result</b></font> </td> <td align="center" valign="middle" bgcolor="#D01818"> <font color="#FFffff"><b>Att</b></font> </td> <td align="center" valign="middle" bgcolor="#D01818"> <font color="#FFffff"><b>Details</b></font> </td> </tr> <?php // Construct db query to get fixtures from database. $selectClause = "SELECT M.MatchID AS id, M.MatchAdditionalType AS additype, O.OpponentName AS opponent, O.OpponentID AS oppid, M.MatchGoals AS goals, M.MatchGoalsOpponent AS goals_opponent, M.MatchPenaltyGoals AS penalty_goals, M.MatchPenaltyGoalsOpponent AS penalty_goals_opponent, M.MatchOvertime AS overtime, M.MatchPenaltyShootout AS penalty_shootout, DATE_FORMAT(M.MatchDateTime, '%M %Y') AS month, DATE_FORMAT(M.MatchDateTime, '%a %e') AS date, DATE_FORMAT(M.MatchDateTime, '%H:%i') AS time, M.MatchPlaceID AS place, M.MatchAttendance AS att, M.MatchPublish AS publish, MT.MatchTypeName AS typename, P.PreviewText AS prewtext FROM ( tplss_matches M, tplss_matchtypes MT, tplss_opponents O ) LEFT OUTER JOIN tplss_previews P ON M.MatchID = P.PreviewMatchID "; if (($defaultseasonid != 00) && ($defaultmatchtypeid != 0)) { $whereClause = "WHERE M.MatchTypeID = '$defaultmatchtypeid' AND M.MatchSeasonID = '$defaultseasonid' AND M.MatchTypeID = MT.MatchTypeID AND M.MatchOpponent = O.OpponentID "; } elseif (($defaultseasonid == 0) && ($defaultmatchtypeid != 0)) { $whereClause = "WHERE M.MatchTypeID = '$defaultmatchtypeid' AND M.MatchTypeID = MT.MatchTypeID AND M.MatchOpponent = O.OpponentID "; } elseif (($defaultseasonid != 0) && ($defaultmatchtypeid == 0)) { $whereClause = "WHERE M.MatchSeasonID = '$defaultseasonid' AND M.MatchTypeID = MT.MatchTypeID AND M.MatchOpponent = O.OpponentID "; } elseif (($defaultseasonid == 0) && ($defaultmatchtypeid == 0)) { $whereClause = "WHERE M.MatchTypeID = MT.MatchTypeID AND M.MatchOpponent = O.OpponentID "; } $orderByClause = "ORDER BY M.MatchDateTime"; // Execute query. $sql = $selectClause . $whereClause . $orderByClause; $get_matches = mysql_query($sql, $connection) or die(mysql_error()); // Loop round fixtures (which come back from database in date order). while($data = mysql_fetch_array($get_matches)) { // Print a month header row each time we hit a new month. if ($data['month'] <> $lastMonth) { echo "<tr>\n"; echo '<td align="left" valign="middle" bgcolor="#7c0606" colspan="9">'; echo '<font color="#FFffff"><b>' . $data['month'] . "</b></font>"; echo "</td>\n"; echo "</tr>\n\n"; $lastMonth = $data['month']; } // Assign home/away based vars. if ($data['place'] == 1) { $placeBg = $bg4; $venue = "H"; } else { $placeBg = $bg3; $venue = "A"; } // Print date and venue. echo"<tr>\n"; echo '<td align="left" valign="middle" bgcolor="' . $placeBg . '">'; echo $data['date']; echo "</td>\n"; echo '<td align="center" valign="middle" bgcolor="' . $placeBg . '">'; echo $venue; echo "</td>\n"; // Print opponent team name (as a link if possible). echo '<td align="left" valign="middle" bgcolor="' . $placeBg . '">'; if ($data['oppid'] == 1) { echo '$data[opponent]'; } else { echo '<a href="opponent.php?opp=' . $data['oppid'] . '">' . $data['opponent'] . "</a>"; } echo "</td>\n"; // Print competition type. echo '<td align="left" valign="middle" bgcolor="' . $placeBg . '">'; echo $data['typename']; if ($data['additype'] != '') { echo " / " . $data['additype']; } echo "</td>\n"; // Print result, attendance and match report. if ($data['goals'] == NULL || $data['goals_opponent'] == NULL) { // No goals recorded - match can't have been played yet - print empty fields. echo '<td bgcolor="' . $placeBg . '"> </td>' . "\n"; echo '<td bgcolor="' . $placeBg . '"> </td>' . "\n"; echo '<td bgcolor="' . $placeBg . '"> </td>' . "\n"; echo '<td align="center" valign="middle" bgcolor="' . $placeBg . '">'; if ($data['prewtext'] == '') { echo " "; } else { echo '<a href="preview.php?id=' . $data['id'] . '">' . $txt_preview . "</a>"; } echo "</td>\n"; } else { // Goals recorded - figure out result and score - print required fields. if ($data['penalty_goals'] == NULL || $data['penalty_goals_opponent'] == NULL) { if ($data['goals'] > $data['goals_opponent']) $result = '<img src="images/win.jpg">'; elseif ($data['goals'] < $data['goals_opponent']) $result = '<img src="images/lose.jpg">'; else $result = '<img src="images/draw.jpg">'; $score = $data['goals'] . " - " . $data['goals_opponent']; } else { if ($data['penalty_goals'] > $data['penalty_goals_opponent']) $result = "<b>W</b>"; else $result = "L"; $score = $data['goals'] . " - " . $data['goals_opponent'] . " (" . $data['penalty_goals'] . " - " . $data['penalty_goals_opponent'] . ")"; } echo '<td align="center" valign="middle" bgcolor="' . $placeBg . '">' . $result . "</td>\n"; echo '<td align="center" valign="middle" bgcolor="' . $placeBg . '">' . $score . "</td>\n"; echo '<td align="center" valign="middle" bgcolor="' . $placeBg . '">' . $data['att'] . "</td>\n"; if($data['publish'] == 1) { echo '<td align="center" valign="middle" bgcolor="' . $placeBg . '"><a href="matchdetails.php?id=' . $data['id'] . '">Yes</td></a></td>' . "\n"; } else { echo '<td align="center" valign="middle" bgcolor="' . $placeBg . '"> </td></a></td>' . "\n"; } } echo "</tr>\n\n"; } // Free resultset. mysql_free_result($get_matches); ?> </table> </td> </tr> </table> </td> </tr> </table> <?php // Print tpl soccers stats message. include('bottom.txt'); ?> </form> <?php // Finish off html. include('footer.php'); ?> I'm trying to generate a page with javascript in it with PHP. But the quotations are causing me problems, I need a third set of quotations. Here is the part I am having trouble with: echo"<div class='level'>Edit:</div><div class='box'><input type = 'text' size='50' name='cat' value='$cat'/> <b><input type='button' value='+ Details' onclick='document.getElementById('rev$clicker').style.display='block';'/></b> </div><br>"; When I view the html it comes out onclick='document.getElementById('rev$clicker').style.display='block';' I can't use "" quotations for 'block' and 'rev$clicker' because that would exit from the echo and I can't exit php because I need the $clicker variable. |