Jump to content

Recommended Posts

I can pass the phone number, and redirect URL ok, but i cant seem to pass the phone number, or account name successfully after the post, andy ideas?

 

<?php
if($_SERVER['REQUEST_METHOD'] == "POST"){
require_once ('connect.php'); 
require_once ('opendb.php');
$groupid_sent = $_GET['actname'];
$query = "SELECT * FROM zipcodes WHERE account_name='$groupid_sent' group by account_name"; 
$result = @mysql_query ($query); 
$count = mysql_num_rows($result); //number of results  
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ 
$groupid_sent= $row['account_name'] ;
$account_name= $row['company_name'] ;
$zip_id = $row['search_id'] ;
}
}else{ 
require_once ('connect.php'); 
require_once ('opendb.php');  
$groupid_sent = $_GET['groupid'];	
$query = "SELECT * FROM zipcodes WHERE account_name='$groupid_sent' group by account_name"; 
$result = @mysql_query ($query); 
$count = mysql_num_rows($result); //number of results 
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ 
$groupid_sent= $row['account_name'] ;
$account_name= $row['company_name'] ;
$zip_id = $row['search_id'] ;
}}?> 

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>TEST EDITOR</title>
</head>
<body>
<?php echo "<h3>$groupid_sent - $account_name </h3>"; ?>
<fieldset>
<a href="index.php">Home</a> || <a href="editaccount.php?groupid=<?php echo $groupid_sent; ?>">Account</a> || <a href="viewzips.php?groupid=<?php echo $groupid_sent; ?>">Active Zips</a> - <a href="pausedzips.php?groupid=<?php echo $groupid_sent; ?>">Paused Zips</a> || <a href="pause.php?groupid=<?php echo $groupid_sent; ?>">Pause Account</a> || <a href="testzips.php?groupid=<?php echo $groupid_sent; ?>">Test Zips</a>
</fieldset>
<p>

<?php

if (isset($_POST['submit'])) {

    //define all your post variables here
$phone_number = mysql_real_escape_string($_POST['phonenumber1']);
$redirect_url = mysql_real_escape_string($_POST['redirecturl1']);
$groupid_sent = mysql_real_escape_string($_POST['groupid1']);
$account_name = mysql_real_escape_string($_POST['accountname1']);


    
//Run Update Function 
   $query = "UPDATE zipcodes SET redirect_url='$redirect_url', phone_number='$phone_number', groupe_name='$groupid_sent', account_name='$account_name' WHERE account_name='$account_name'";
    $result = mysql_query($query)or die(mysql_error());
    
// Confirmation that updated worked
    echo "Client Updated Successfully Updated $phone_number - $groupid_sent - $account_name - $redirect_url";

} else {
    
    require_once('connect.php');
    require_once('opendb.php');
    
    $groupid_sent = $_GET['groupid'];
    $query = "SELECT * FROM zipcodes WHERE search_id='$zip_id'";
    $result = @mysql_query($query);
    $count = mysql_num_rows($result);
    
    //number of results
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        // Database Values
        $groupid_sent= $row['account_name'] ;
        $account_name= $row['company_name'] ;
        $zip_id = $row['search_id'] ;
        $zipcode = $row['zipcode'];
        $city = $row['city'];
        $rank = $row['rank'];
        $redirect_url = $row['redirect_url'];
        $notes_1 = $row['notes_1'];
        $phone_number = $row['phone_number'];
        $groupe_name = $row['groupe_name'];
        $on_off = $row['on_off'];
        $test_zip = $row['test_zip'];
        
        echo "<form action='editaccount.php?actname=$groupid_sent' method='post'>";
	echo "<input type=hidden name=zipid1 value='$zip_id>"; // Hidden Field
	echo "<input type=hidden name=groupid value='$groupid_sent'>"; // Hidden Field
        echo "Company Name: <input type=text name=company_name1 size=75 value='$account_name' > <br>";
        echo "Redirect URL: <input type=text name=redirecturl1 size=75 value='$redirect_url' > <br>";
        echo "Phone Number: <input type=text name=phonenumber1 value='$phone_number' ><br>";
        echo "Group Name: <input type=text name=groupname1 value='$groupe_name' ><br>";
        echo "<input type=submit name=submit value=update>";
        echo "</form>";
    }    
}

?>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/71582-select-not-gettting-data/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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