Jump to content

[SOLVED] echo, cant get 1 thing to print :(


jjmusicpro

Recommended Posts

i am passing a value of : $vsrefdom = $_GET['_vsrefdom'];

 

However, when i am trying to put the value of the pass variable in the output in my echo, however it wontput it in the hyperlink, everything else is fine

 

ANy ideas?

 

while($acc3=mysql_fetch_array($acc2)) {
     echo '<tr><td colspan=2 valign="middle">' . $acc3['company_name'] . '<br>' .$acc3['notes_1'] . '</b></td></tr><tr><td valign=top><img src=mm_smaller.gif></td><td>' .'<b>Phone:</b>'. ' ' . $acc3['phone_number'] . '<br>'.'<a href="'. $acc3['redirect_url'] . '?_vsrefdom=' . $vsrefdom . '"> Visit Website </a>'. ' ' .'</td></tr>'; 
    }echo '</table>';

Link to comment
https://forums.phpfreaks.com/topic/73697-solved-echo-cant-get-1-thing-to-print/
Share on other sites

Try this:

 

$vsrefdom=$_GET['_vsrefdom'];
while($acc3=mysql_fetch_array($acc2)) {
     echo '<tr><td colspan=2 valign="middle">' . $acc3['company_name'] . '<br>' .$acc3['notes_1'] . '</b></td></tr><tr><td valign=top><img src=mm_smaller.gif></td><td>' .'<b>Phone:</b>'. ' ' . $acc3['phone_number'] . '<br>'.'<a href="'. $acc3['redirect_url'] . '?_vsrefdom=' . $vsrefdom . '"> Visit Website </a>'. ' ' .'</td></tr>'; 
    }
echo '</table>';

<?php
$vsrefdom=$_GET['_vsrefdom'];
while($acc3=mysql_fetch_array($acc2)) {
     echo '<tr><td colspan=2 valign="middle">' . $acc3['company_name'] . '<br>' .$acc3['notes_1'] . '</b></td></tr><tr><td valign=top><img src=mm_smaller.gif></td><td>' .'<b>Phone:</b>'. ' ' . $acc3['phone_number'] . '<br>'.'<a href="'. $acc3['redirect_url'] . '?_vsrefdom=' . $vsrefdom . '"> Visit Website </a>'. ' ' .'</td></tr>'; 
    }
echo '</table>'; ?>

Hm.. I think you can't start a variable with an underscore. Try removing the underscore..

 

$vsrefdom=$_GET['vsrefdom'];
while($acc3=mysql_fetch_array($acc2)) {
     echo '<tr><td colspan=2 valign="middle">' . $acc3['company_name'] . '<br>' .$acc3['notes_1'] . '</b></td></tr><tr><td valign=top><img src=mm_smaller.gif></td><td>' .'<b>Phone:</b>'. ' ' . $acc3['phone_number'] . '<br>'.'<a href="'. $acc3['redirect_url'] . '?vsrefdom=' . $vsrefdom . '"> Visit Website </a>'. ' ' .'</td></tr>'; 
    }
echo '</table>';

I think i found the problem, i have a page called process.php that it hits first before going to his page, it dosent seem tobe passing that value.

 

I have 3 things that can happne, if 0 results are found go to nf.php, if 1 is found, go to its url from the db, and pass that value - that works...

 

if anything else, i want it to go to shard.php, and do the code i posted above, and in the URL's put that value.

 

here is my code for process.php

 

$vsrefdom = $_GET['_vsrefdom'];
echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$site?_vsrefdom=" . $_GET['_vsrefdom'] . "\">";
}}else{ $vsrefdom = $_GET['_vsrefdom'];
echo "<meta http-equiv=\"Refresh\" content=\"0;url=shared.php?_vsrefdom=" . $_GET['$_vsrefdom'] .' &groupid' . $_GET['groupid'] . '&zipcode_entered_search=' . $zipcode ."\">"; } }else{ } 
?>

Here is my whole code:

 

It works if it just gets 1 result, and goes to the URL, however it wont pass the vsrefdom variable of 0 or 2+ zipcodes are found.

 

<?php
if($_SERVER['REQUEST_METHOD'] == "POST"){ 
$zipcode = $_POST['zipcode_entered_search']; 
$vsrefdom = $_GET['_vsrefdom'];
$query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())";
$result2 = mysql_query($query2); 
$query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; 
$result = @mysql_query ($query); 
$count = mysql_num_rows($result); 
if($count=="0"){ 

// Set VSREFDOM in URL
$vsrefdom = $_GET['_vsrefdom'];

echo "<meta http-equiv=\"Refresh\" content=\"0;url=nf.php?_vsrefdom=" . $_GET['$_vsrefdom'] .' &groupid='. $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">";

}else if($count=="1"){ 
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ 

$vsrefdom = $_GET['_vsrefdom'];
$site = $row['redirect_url'] ;
echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$site?_vsrefdom=" . $_GET['_vsrefdom'] . "\">";
}}else{ $vsrefdom = $_GET['_vsrefdom'];
echo "<meta http-equiv=\"Refresh\" content=\"0;url=shared.php?_vsrefdom=" . $_GET['$_vsrefdom'] .' &groupid=' . $_GET['groupid'] . '&zipcode_entered_search=' . $zipcode ."\">"; } }else{ } 
?>

Archived

This topic is now archived and is closed to further replies.

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