Guys, need help. From the admin panel, i need to set a form of two kinds. 1. Only Customer name. 2. Customer Name and more Details about the customer name. What i would like is, if you fill out form #2, a read more button should appear after the customer name. So the form will be on the admin side and the read more on the main site. Thankyou **Hope i made sense.
Try: <input type="text" onchange="if(this.value != ''){document.getElementById('readmore').style.display='block';}" /> <input type="button" onclick="window.location='readmore.php';" value="Read more" id="readmore" /> HTML:
Hi, thank you for the help. Dunno if this is possible, but could i have an ajax in the admin panel, where by if you click to add more details, the other box should open of the form so everything is in one place, or am i asking for 2 much ? Secondly the code you gave me, the id needs to be of a different field correct.
Ohhh sorry if im sounding dumb, But is it possible to have a button, where you can click to enable the boxes to fill in Short Description Succes story and so on. Keeping Client name and Industry field already enabled. Below is the code for the form from the admin side. **READ BELOW <form action="add_stories.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr class="bodytext"> <td width="21%"> </td> <td width="31%">Client Name </td> <td width="48%"><font size="2" face="Arial, Helvetica, sans-serif"> <input name="client_name" type="text" class="inputtext" id="client_name" /> </font></td> </tr> <?php include ("lib/connect.php"); $sqlr = "SELECT * FROM tbl_industry"; $resultr = mysql_query ($sqlr, $cn); ?> <tr class="bodytext"> <td> </td> <td>Industry</td> <td><select name="industry" class="inputtext" id="industry"> <option value="0">Select One</option> <?php while ($rowr=mysql_fetch_object($resultr)) { ?> <option value="<?php echo $rowr->id; ?>"><?php echo $rowr->industry_name; ?></option> <?php } mysql_free_result($resultr); //mysql_close($cn); ?> </select> </td> </tr> <tr class="bodytext"> <td> </td> <td valign="top" class="text">Short Description </td> <td><textarea name="short_desc" cols="30" rows="8" id="short_desc"></textarea></td> </tr> <tr class="bodytext"> <td> </td> <td valign="top" class="text">Success Story </td> <td><textarea name="story" cols="30" rows="8" id="story"></textarea></td> </tr> <tr class="bodytext"> <td> </td> <td valign="top" class="text">Project Description </td> <td><textarea name="detail_desc" cols="30" rows="8" id="detail_desc"></textarea></td> </tr> <tr class="bodytext"> <td> </td> <td class="text">News Date </td> <td colspan="2"><font size="2" face="Arial, Helvetica, sans-serif"> <input name="story_date" type="text" class="inputtext" id="story_date" /> </font><a href="javascript:cal9.popup();"><img src="img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a></td> </tr> <script language="JavaScript"> <!-- // create calendar object(s) just after form tag closed // specify form element as the only parameter (document.forms['formname'].elements['inputname']); // note: you can have as many calendar objects as you need for your application var cal9 = new calendar3(document.forms['form1'].elements['story_date']); cal9.year_scroll = true; cal9.time_comp = false; //--> </script> <tr class="bodytext"> <td> </td> <td class="text">Client logo</td> <td><input name="file1" type="file" class="inputtext" id="file1"></td> </tr> <tr class="bodytext"> <td> </td> <td class="text">Case Study </td> <td><input name="file2" type="file" class="inputtext" id="file2"></td> </tr> <tr class="bodytext"> <td> </td> <td class="text">Completion Certificate </td> <td><input name="file3" type="file" class="inputtext" id="file3"></td> </tr> <tr> <td> </td> <td class="text"><font size="2" face="Arial, Helvetica, sans-serif"> </font></td> <td><font size="2" face="Arial, Helvetica, sans-serif"> <input name="Submit" type="submit" class="buttonstyle" value="Add" /> </font></td> </tr> </table> </form> PHP: After this, having the read more command if short description and other fields are entered or else to just show the client name. ***Hope i made sense again.. and kindly ignore the above posts. except elias_sorensen help.
There you go buddy: <script type="text/javascript"> function showMoreOptions(optionsButton){ var optionsTable = document.getElementById("moreInputs"); if(optionsTable.style.display == "none"){ optionsTable.style.display = 'block'; optionsButton.value = 'Less options'; }else{ optionsTable.style.display = 'none'; optionsButton.value = 'More options'; } } </script> <form action="add_stories.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr class="bodytext"> <td width="21%"> </td> <td width="31%">Client Name </td> <td width="48%"><font size="2" face="Arial, Helvetica, sans-serif"> <input name="client_name" type="text" class="inputtext" id="client_name" /> </font></td> </tr> <?php include ("lib/connect.php"); $sqlr = "SELECT * FROM tbl_industry"; $resultr = mysql_query ($sqlr, $cn); ?> <tr class="bodytext"> <td> </td> <td>Industry</td> <td><select name="industry" class="inputtext" id="industry"> <option value="0">Select One</option> <?php while ($rowr=mysql_fetch_object($resultr)) { ?> <option value="<?php echo $rowr->id; ?>"><?php echo $rowr->industry_name; ?></option> <?php } mysql_free_result($resultr); //mysql_close($cn); ?> </select> </td> </tr> <tr class="bodytext"> <td> </td> <td valign="top" class="text"><input type="button" value="More options" onclick="showMoreOptions(this);"/></td> <td></td> </tr> </table> <table style="display:none;" id="moreInputs" width="90%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr class="bodytext"> <td> </td> <td valign="top" class="text">Short Description </td> <td><textarea name="short_desc" cols="30" rows="8" id="short_desc"></textarea></td> </tr> <tr class="bodytext"> <td> </td> <td valign="top" class="text">Success Story </td> <td><textarea name="story" cols="30" rows="8" id="story"></textarea></td> </tr> <tr class="bodytext"> <td> </td> <td valign="top" class="text">Project Description </td> <td><textarea name="detail_desc" cols="30" rows="8" id="detail_desc"></textarea></td> </tr> <tr class="bodytext"> <td> </td> <td class="text">News Date </td> <td colspan="2"><font size="2" face="Arial, Helvetica, sans-serif"> <input name="story_date" type="text" class="inputtext" id="story_date" /> </font><a href="javascript:cal9.popup();"><img src="img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a></td> </tr> <script language="JavaScript"> <!-- // create calendar object(s) just after form tag closed // specify form element as the only parameter (document.forms['formname'].elements['inputname']); // note: you can have as many calendar objects as you need for your application var cal9 = new calendar3(document.forms['form1'].elements['story_date']); cal9.year_scroll = true; cal9.time_comp = false; //--> </script> <tr class="bodytext"> <td> </td> <td class="text">Client logo</td> <td><input name="file1" type="file" class="inputtext" id="file1"></td> </tr> <tr class="bodytext"> <td> </td> <td class="text">Case Study </td> <td><input name="file2" type="file" class="inputtext" id="file2"></td> </tr> <tr class="bodytext"> <td> </td> <td class="text">Completion Certificate </td> <td><input name="file3" type="file" class="inputtext" id="file3"></td> </tr> <tr> <td> </td> <td class="text"><font size="2" face="Arial, Helvetica, sans-serif"> </font></td> <td><font size="2" face="Arial, Helvetica, sans-serif"> <input name="Submit" type="submit" class="buttonstyle" value="Add" /> </font></td> </tr> </table> </form> HTML:
Thank you my man, now could i have this such that on the main page, a read more button is shown, if more options are filled in, as in more then the cutomer name and industry, so then the read more button is shown. My current code below has the id linked, what i want is (explaining again) if more options filled then a read more button to show up next to the customer name and it being linked to its id, else no read more button. <tbody> <tr> <td width="3%"> </td> <td width="93%"><div align="left"><a class="navigationbar" href="index.php">Home</a> <span class="pressdate">></span> <span class="pressdate">Success Stories </span></div></td> <td width="3%"> </td> </tr> <tr> <td> </td> <td><hr color="#cccccc" noshade="noshade" size="1" /> </td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bgfooter"><div align="left" class="heading"> Corporate Sector</div> </td> <td> </td> </tr> <tr> <td> </td> <td align="left"> </td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bodytext"> <?php include ("lib/connect.php"); $mylink = ""; $sqlr = "SELECT * FROM tbl_stories where client_industry = 4 and archive_story =0 order by completion_date DESC"; $resultr = mysql_query ($sqlr, $cn); ?> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <?php while ($rowr=mysql_fetch_object($resultr)) {?> <tr> <td width="5%" valign="top"><img src="images/bbb.jpg" width="15" height="9" /></td> <td width="95%" valign="top"><div align="left"> <a href="stories_cs.php?s=1&id=<?php echo $rowr->id;?>#<?php echo $rowr->id;?>" class="bluebold2"><?php echo $rowr->client_name; ?></a> </div></td> </tr> <?php } mysql_free_result($resultr); ?> </table> </td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bodytext"> </td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bgfooter"><div align="left" class="heading"> Financial Services </div> </td> <td> </td> </tr> <tr> <td> </td> <td align="left"> </td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bodytext"> <?php include ("lib/connect.php"); $mylink = ""; $sqlr = "SELECT * FROM tbl_stories where client_industry = 1 and archive_story =0 order by completion_date DESC"; $resultr = mysql_query ($sqlr, $cn); ?> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <?php while ($rowr=mysql_fetch_object($resultr)) {?> <tr> <td width="5%" valign="top"><img src="images/bbb.jpg" width="15" height="9" /></td> <td width="95%" valign="top"><div align="left"><a href="stories_fs.php?s=1&id=<?php echo $rowr->id;?>#<?php echo $rowr->id;?>" class="bluebold2"><?php echo $rowr->client_name; ?></a></div></td> </tr> <?php } mysql_free_result($resultr); ?> </table></td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bodytext"> </td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bgfooter"><div align="left" class="heading"> Public Sector </div> </td> <td> </td> </tr> <tr> <td> </td> <td align="left"> </td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bodytext"> <?php include ("lib/connect.php"); $mylink = ""; $sqlr = "SELECT * FROM tbl_stories where client_industry = 2 and archive_story =0 order by completion_date DESC"; $resultr = mysql_query ($sqlr, $cn); ?> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <?php while ($rowr=mysql_fetch_object($resultr)) {?> <tr> <td width="5%" valign="top"><img src="images/bbb.jpg" width="15" height="9" /></td> <td width="95%" valign="top"><div align="left"><a href="stories_ps.php?s=1&id=<?php echo $rowr->id;?>#<?php echo $rowr->id;?>" class="bluebold2"><?php echo $rowr->client_name; ?></a></div></td> </tr> <?php } mysql_free_result($resultr); ?> </table></td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bodytext"> </td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bgfooter"><div align="left" class="heading"> Telecommunications </div> </td> <td> </td> </tr> <tr> <td> </td> <td align="left"> </td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bodytext"> <?php include ("lib/connect.php"); $mylink = ""; $sqlr = "SELECT * FROM tbl_stories where client_industry = 3 and archive_story =0 order by completion_date DESC"; $resultr = mysql_query ($sqlr, $cn); ?> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <?php while ($rowr=mysql_fetch_object($resultr)) {?> <tr> <td width="5%" valign="top"><img src="images/bbb.jpg" width="15" height="9" /></td> <td width="95%" valign="top"><div align="left"><a href="stories_ts.php?s=1&id=<?php echo $rowr->id;?>#<?php echo $rowr->id;?>" class="bluebold2"><?php echo $rowr->client_name; ?></a></div></td> </tr> <?php } mysql_free_result($resultr); ?> </table></td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bodytext"> </td> <td> </td> </tr> <tr> <td> </td> <td align="left" class="bodytext"><br /> <br /> <p class="bodycontentgrey"> </p></td><td> </td> </tr> </tbody> PHP:
Hi, Sorry for my late reply... Forgot your thread. I don't really understand what you want to accomplish. Can you please describe it better? Thanks.
Glad to hear that you've managed to do it yourself. You learn more that way But sorry to hear that you spent 4 hours on it, just because I forgot it.