Jump to content

jonw118

Members
  • Posts

    77
  • Joined

  • Last visited

    Never

Posts posted by jonw118

  1. Hello. I'd greatly appreciate any help!!!

     

    Basically I have a form on my page. When this form is field out it posts the results to the iContact (subscribes to a list).

     

    iContact requires that form field for email be called "fields_email". Ok.

     

    Now, I have a redirect URL we have to use which needs the email in the URL string. For example, the form field "fields_email" has a value of test@test.com. For that redirect link I need it to be: http://www.test.com/email=test@test.com.

     

    See below:

    <form method=post action="https://app.icontact.com/icp/signup.php" name="icpsignup" id="XXXX" accept-charset="UTF-8";" >

    <input type=hidden name=redirect value="http://XXXXX.com/?email="FIELDS_EMAIL" />

    <label>Primary Email</label> <input type="text" name="fields_email" id="fields_email">

     

    How can I replace the "FIELDS_EMAIL" in the redirect URL with the value entered by the user?

     

    I hope this makes sense. Thanks again for any help!

     

  2. I am using the following php script to display all the files that are uploaded in a directory on a page. There are two files in the folder I do not want displayed: .htaccess & index.php.

     

    Can someone help me out and provide a little guidance about what I need to do to print all the file names EXCEPT for those two. I imagine some sort of if statement.

     

    CODE:

     

    Top of page:

    <?php
    $dirname = ".";
    $dir = opendir($dirname);
    ?>

     

    Body:

    <?php
    while(false != ($file = readdir($dir)))
    {
    if(($file != ".") and ($file != ".."))
    {
    echo("<a href='$dirname$file'>$file</a> <br />");
    }
    }
    ?>

     

    Thanks so much!

  3. Hi all - I'd greatly appreciate any help.

     

    I am using phpMyAdmin and trying to export a table to a CSV.

     

    Many rows within the CSV do not have any values in any of the columns.

     

    When I go to export to CSV it "skips" these rows and doesn't export them.

     

    Does anyone know if it's possible to export the rows to CSV even if there are null values in a rows columns?

     

    Thanks!

  4. Awesome!!! Thanks so much for the help.

     

    Now, here is a little tricky question since I can now get them all in a table. In the function it calls to order them by ID. Is there anyway it could order them all alpha versus the "ORDER BY 'id'" or is that not possible because of this statement in the function (which is needed for the category specific pages):

     

       $sql = "SELECT * FROM `".TBL_PORTFOLIO."` WHERE id IN (SELECT `portfolio_id` FROM `".TBL_PORTFOLIO_INDUSTRY."` WHERE `industry` = '$industry') ORDER BY `id`";
       $data=SelectMultiRecords($sql);
       return $data;
    }

     

     

  5. Hi there,

     

    I have a site that has several different pages which display products from each category on the designated page.

     

    What I am looking to do is create one page that also lists ALL the products.

     

    Right now, in the category specific page it has this is in the code:

    $data = get_portfolio_industry('Building Products');
    $offset = $_GET['offset'];
    if($offset == ''){
    $offset = 0;
    }
    function get_industries($rec_id){
    $sql = "SELECT * FROM `".TBL_PORTFOLIO_INDUSTRY."` WHERE `portfolio_id` = '$rec_id'";
    $data = SelectMultiRecords($sql);
    return $data;
    }
    

     

    And this is the from the functions file:

    function get_portfolio_industry($industry){

    	$sql = "SELECT * FROM `".TBL_PORTFOLIO."` WHERE id IN (SELECT `portfolio_id` FROM `".TBL_PORTFOLIO_INDUSTRY."` WHERE `industry` = '$industry') ORDER BY `id`";
    $data=SelectMultiRecords($sql);
    return $data;
    }

     

    My hope was I would simple combine the products like this:

    $data = get_portfolio_industry('Building Products,Building Services,General Products');

     

    ...but unfortunately it doesn't combine them. Any thoughts? Any help would be much appreciated.

     

  6. Hi there - can anyone lend me a little advise as to what I'm doing wrong here.

     

    I have this line:

    $query=mysql_query("SELECT * FROM gallery a JOIN gallery_image b ON a.id = b.gallery_id where gallery_id=$gallery_id");

     

    I am trying to add an order by statement: order by gallery_image.priority

     

    So I created:

    $query=mysql_query("SELECT * FROM gallery a JOIN gallery_image b ON a.id = b.gallery_id where gallery_id=$gallery_id order by gallery_image.priority");

     

    But, I receive the error (even though there is table called "Gallery Image" and a column called "Priority":

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/***/public_html/***/gallery.php on line 5
    select: Unknown column 'gallery_image.priority' in 'order clause'

  7. Hello...

     

    I'm not sure how to (if it can be done) restrict an image height ONLY if it is over a certain amount of pixels.

     

    Specifically, right now the script resizes images by width only. But sometimes, if an image that is long vertically is uploaded it throws the format off, so in that case, I do want it resize by width AND height, but only in that case.

     

    I hope that makes sense.

     

    Basically if right now an image is inserted that is 1500px x 1500px I only want it to scale the image width (ie, scaled to 150px wide), keeping the height in proporotion automatically (150px height for this example). But if an image is 1500 x 4000, for example, I'd like it to scale to something like (150px X 150px)... and yes I know it will distort the image, but it will be better than how it breaks the format currently.

     

    Is this possible?

     

    The specific code I am working with is:

     

    <img style='float: center; margin-right: 5px;' width='150px' src='$img' />

     

    Thanks for any suggestions!!!

  8. Hello...

     

    I have a website that has worked with no problem. I login using .../admin and enter credentials.

     

    I've moved it to a new server and frontend works fine.

     

    When I trying logging in the backend, it I enter the wrong user/pass it tells me wrong user/pass. But when I enter in the correct credentials it simply reloads the login page versus the index page with no message. Since I get the message when it's incorrect I know it's connecting to the DB.

     

    The php versions are the same. I have php error logging and it's not giving an error.

     

    Can anyone give me tips or advice as to what I should be looking for?

     

    Thanks!

  9. I have program that pulls in a lot of different modules and centralizes them to one menu. One of the modules lists all the individual CMS pages. I need these pages to display by the "priority" column.

     

    Unfortunately I've tried alot of different things to sort the CMS module pages by priority, but to no success. I hope I am providing all that is needed from the code here - and if anyone could lend any advise as to where I add the ORDER BY priority ASC I'd appreciate.

     

    From the index page, here is the code that loads the modules... this is where I've been trying to dissect where modules join and how to create a sort order for bullet point CMS pages:

     

    <?php
    						foreach($sorted_modules as $module_name=>$seq)
    						{
    							if(count($menus[$module_name])==0 ) continue;?>
    						<tr valign=top align=left>
    							<td width=139 class="TextObject" style='padding-left:10px'>
    								<?php if(strlen($menu_text[$module_name])>0)
    								{?>
    		<p><b><span	style="font-family: Arial, Helvetica, Geneva, Sans-serif; font-size: 11pt;">
    		<?php echo ucwords($menu_text[$module_name]);?>-
    		</span></b></p>
    								<?php
    								}
    		foreach($menus[$module_name] as $name=>$action)
    		echo "<li><span style='font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 10pt; color: rgb(39,90,121);'><a href='index.php?module=$module_name&action=$action'/>$name</a></span></li>";?>
    							</td>
    						</tr>
    						<?php
    						}?>

     

    Thanks - hope this makes sense what I'm trying to do!

  10. "Databases do not store data in any particular order, it is up to you to write your select statements in such a way the the data is retrieved in the order you want."

     

    Yeah I know it's not written/stored in a particular order, and understand it's not flat, but once the data is in there the row location doesn't change. So that's all I'm trying to do is change the order it's stored (or shown in phpMyAdmin)... because the order it is stored is the order it displays on the frontend. But as I feared and as you confirmed there's nothing I can do about that I guess.

     

     

    "I fail to see why. Can you tell us why you can't?"

     

    It is pulling many different modules menus loading into a centralized menu, the modules are then joined with one another and the module in question displays several different levels of navigation (which needs to be sorted). But the other modules do not need to be sorted. And it is the same statement joining all of these together. I know that sounds confusing, just the way it was written, which I've struggled to dissect and implement an effective order by.

  11. I have a unique situation where I have a php script that is very complex and I cannot do a simple order by priority. Instead it displays the data on the frontend in the exact order it is stored in the MySQL database.

     

    Is there any way (I've looked high and low!) to change the order that rows appear in the MySQL database. Ideally I'd like for the table to display the table rows in asc order by the column "page_name".

     

    Not sure this is possible to alter the table to achieve this. Does anyone know?

     

    Thanks much for any help!

  12. Keith- soooo sorry - hope you don't mind me asking you one more thing. On one of the gallery pages I have 3 photos displayed - and the gallery_name (which we were working on adding) at the top of the page is showing 3 different times. I'm using <?php echo $res['gallery_name']; ?> to show the name. Again, thank you so much for your help. Hope this is something simple I'm missing. I've been pulling the hair trying different things.

  13. I think I see what the problem is here - not sure how I got that empty error - can't duplicate it.

     

    But I just the mysql_error - and got the result:

     

    "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/***/main/gallery.php on line 5

    select: Column 'priority' in order clause is ambiguous"

     

    I think this is because both gallery has a priority and gallery_image has a priority. For the gallery priority, it is irrelevant on this page (as it set priority for the gallery options page). But it does need the priority for the gallery_image as it sets the sort order for the pictures.

  14. Keith - thanks for the response!

     

    They are linked by ID. The table "gallery" has the columns:

    -id

    -gallery_name

    -main_desc

    -priority

     

    The table "gallery_image" has:

    -id

    -gallery_id

    -title

    -description

    -priority

     

    Hope that can give some more insight!

     

    Thanks again for the help!

  15. So - I have data I need to pull from two tables in one MySQL database.

     

    When you create an Image Gallery you give it a name - which is stored in the table "gallery" under the column "gallery_name".

     

    However, the gallery page doesn't display the Gallery Name which I want it to.

     

    Currently the page has at the top:

     

    <?php
    include_once('/home/***/admin/info.php');
    $gallery_id=$_GET['id'];
    $query=mysql_query("SELECT * FROM gallery_image where gallery_id=$gallery_id order by priority") ;
    $res = mysql_num_rows($query);
    ?>

     

    So, I want to pull the field "gallery_name" from the the table "gallery".

     

    I'd imagine I'd insert something along the lines of: <?php echo $res['gallery_name']; ?> in the page where I want the code insterted. But just not sure how to get it to pull that from the table "gallery" since right now it's just pulling from the table "gallery_name".

     

    Thanks!

    Any thoughts or help would be GREATLY appreciated.

  16. I have a page where I am trying to essentially clone a field (called "gallery_name") to insert a new field ("main_desc") into the MySQL database... but it's not inserting the data. Does anyone have a clue as to what I may be doing wrong? I'd appreciate any help. Below you can see the different areas I cloned the gallery_name (I highlighted what I added in red). Thanks!!!

     

    if(isset($_POST['save_gallery']))
    {
    $validation_success=true;
    if(strlen($_POST['gallery_name'])==0)
    	{
    	$validation_success=false;
    	$form_validation['error_gallery_name']=true;
    	$error_msg="Field 'Gallery Name' cannot be blank";
    	}
    [color=red]
    if(strlen($_POST['main_desc'])==0)
    	{
    	$validation_success=false;
    	$form_validation['error_main_desc']=true;
    	$error_msg="Field 'Gallery Description' cannot be blank";
    	}		[/color]
    
    if($validation_success)
    	{
    	$gallery_name=$_POST['gallery_name'];
    [color=red]$main_desc=$_POST['main_desc'];[/color]
    
            $max_priority=q()->gallery()->max()->priority;
    	q()->gallery=array('gallery_name'=>$gallery_name,'priority'=>$max_priority+1);
            $insert_id=q()->gallery->insert_id;
            if(strlen($_FILES['main_image']['tmp_name'])>0)
                {
                $tmp_name=$_FILES['main_image']['tmp_name'];
                resize_img($tmp_name, "../uploads/images/gallery_main_$insert_id", 'jpg',MAX_IMAGE_X,MAX_IMAGE_Y);
                }
    
            }
    }
    else
    {
    $_POST+=array_fill_keys(array('gallery_name','[color=red]main_desc[/color]'),'');
    }
    ?>
    

     

    <tr>
                <td <?php if(isset($form_validation['error_gallery_name'])) echo "class='error_field'";?>>
                    Gallery Name
                </td>
                <td <?php if(isset($form_validation['error_gallery_name'])) echo "class='error_field'";?>>
                    <input size=60 type='text' name='gallery_name'  value="<?php echo htmlentities($_POST['gallery_name'],ENT_QUOTES);?>">
                </td>
            </tr>
      
                    [color=red]<tr>
                <td <?php if(isset($form_validation['error_main_desc'])) echo "class='error_field'";?>>
                    Gallery Description
                </td>
                <td <?php if(isset($form_validation['error_main_desc'])) echo "class='error_field'";?>>
                    <input size=60 type='text' name='main_desc'  value="<?php echo htmlentities($_POST['main_desc'],ENT_QUOTES);?>">
                </td>
            </tr>[/color]

     

    This is where I think the problem may be coming from not inserting into the DB:

    <?php
    if(isset($_POST['save_gallery']))
    {
    $validation_success=true;
    if(strlen($_POST['gallery_name'])==0)
    	{
    	$validation_success=false;
    	$form_validation['error_gallery_name']=true;
    	$error_msg="Field 'Gallery Name' cannot be blank";
    	}
    
    if($validation_success)
    	{
    	$update_id=$_POST['update_id'];
    	q()->gallery($update_id)->gallery_name=$_POST['gallery_name'];
    	$row=q()->gallery($update_id);
    
    
    [color=red]if(strlen($_POST['main_desc'])==0)
    	{
    	$validation_success=false;
    	$form_validation['error_main_desc']=false;
    	$error_msg="Field 'Gallery Description' cannot be blank";
    	}
    
    if($validation_success)
    	{
    	$update_id=$_POST['update_id'];
    	q()->gallery($update_id)->main_desc=$_POST['main_desc'];
    	$row=q()->gallery($update_id);	[/color]	
    
    
            if(strlen($_FILES['main_image']['tmp_name'])>0)
                {
                $tmp_name=$_FILES['main_image']['tmp_name'];
                resize_img($tmp_name, "../uploads/images/gallery_main_$update_id", 'jpg',MAX_IMAGE_X,MAX_IMAGE_Y);
                }
        echo msg("Change Successful. <a href='index.php?module=pictures&action=menu_item_pictures'>Click here</a> to return to galleries");
    	}
    }
    elseif(isset($_GET['update_id']))
    {
    $update_id=$_GET['update_id'];
    $row=q()->gallery($update_id);
    }
    ?>

  17. The OP asked

    I can't figure out on radio button how to do it (so it will show what was selected after submit).

     

    Unless this page is merely for learning purposes and there is no reason for the user to actually submit the page I don't see how JavaScript is an answer. Even if you wanted to have the JavaScript determine some value before submission it still couldn't be used for the only solution since the same logic would need to be copied on the server-side to take care of users without JavaScript enabled.

     

     

     

    Yeah, this is for an online calculator - so someone can input variables, click submit and see the updated price. The problem is the user will get confused if they can't remembered what was selected and what wasn't.

  18. First- thanks so much for the help!

     

     

    Mjdamato: I tried your solution, pasted your example in exactly, and when I click submit, the radio buttons didn't stay checked (None of them were selected).

     

     

    Mmarif4u: Can't quite get this one to work either. First it gave an error:

     

    Parse error: syntax error, unexpected '=' in 

     

    So I removed the "=" on the two lines where you had two of them.

     

    That got rid of the error.

     

    But - it didn't keep the settings on the submit. Here's the exact code I used:

     

    <?php
    $v1 = 'unchecked';
    $v2 = 'unchecked';
    
    if (isset($_POST['Submit'])) {
    
    $selected_radio = $_POST['variable_g'];
    
    if ($selected_radio = 'v1') {
    $v1 = 'checked';
    }
    else if ($selected_radio = 'v2') {
    $v2 = 'checked';
    }
    }
    ?>

     

    And

    <Input type = 'Radio' Name ='variable_g' value= '1' <?PHP echo $v1; ?>>
    <Input type = 'Radio' Name ='variable_g' value= '2' <?PHP echo $v2; ?>>

     

    It keeps the first one checked after every submit.

     

    Thanks again for the help!

  19. Hi there- I'm writing a script right now and not sure how I should handle this problem.

     

    Basically it's a form that uses post and when you click submit does simple calculations.

     

    For form fields to get it to keep the values upon submit is no problem, I'm using this:

    <input id="variable_a" type=text name="variable_a" wrap=virtual value="<?php echo $_POST["variable_a"]; ?>" size=3 maxlength=10>

     

    If I didn't echo it, it would lose the value on submit.

     

    BUT - I can't figure out on radio button how to do it (so it will show what was selected after submit). I need one radio button to have a value of "1" and the other to have a value of "2".

     

    Can anyone advise me how to do this?

     

    Thanks!

     

     

×
×
  • 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.