What is wrong with this PHP file? How to let PHP successfully write to the database, automatically jump to this value of the link

Source: Internet
Author: User
Defined (' Pcpay_path ') or Exit;class Record_control extends Admin_control {public function Add () {$uid = $this->_user[' UID '];if (Empty ($_post)) {$this->_pkey = ' content '; $this->_ukey = ' record-add '; $this->_title = ' Publish article '; $this- >_place = ' Content» Article management» Publish article '; $habits = (array) $this->kv->get (' user_habits_uid_ '. $uid); $cid = Isset ($habits [' Last_add_cid '])? (int) $habits [' Last_add_cid ']: 0; $data = $this->kv->get (' auto_save_record_uid_ '. $uid); if ($data) {!empty ($data [' CID ']) && $cid = $data [' CID '];} else{$data [' intro '] = Array (); $data [' views '] = 0;} $this->assign (' data ', $data); $cidhtml = $this->category->get_cidhtml_by_mid (2, $cid); $this->assign (' Cidhtml ', $cidhtml); $edit _cid_id = ' &mid=2 '; $this->assign (' edit_cid_id ', $edit _cid_id); $this->display (' Record_set.htm ');} else{$cid = intval (R (' CID ', ' P ')), $products = Intval (R (' products ', ' P ')), $amount = Intval (R (' Amount ', ' P ')); $pc = Intval ( R (' pc ', ' P ')); $data = Array (' cid ' = $cid, ' products ' =&Gt $products, ' amount ' = $amount, ' ip ' = Ip2long ($_env[' _ip '),); $this->cms_content->table = ' Cms_record '; $ id = $this->cms_content->create ($data), if (! $id) {E (1, ' Write table error ');} $this->_user[' contents ']++; $this->user->update ($this->_user); $categorys [' count ']++; $this Category->update ($categorys); $this->category->update_cache ($cid); $data = $this->kv->delete (' Auto_ Save_record_uid_ '. $uid); $habits = (array) $this->kv->get (' user_habits_uid_ '. $uid); $habits [' last_add_cid '] = $ CID; $habits = $this->kv->set (' user_habits_uid_ '. $uid, $habits);//e (0, ' publish complete '. $endstr); if (! $data->e (0,$ ENDSTR) {echo $errormsg;} ElseIf ($pc = = "hh") {$url = "www.w3school.com.cn"; Header ("Location: $url"); Exit;} ElseIf ($pc = = "ff") {$url = "www.baidu.com"; Header ("Location: $url"); Exit;} ElseIf ($pc = = "dd") {$url = "bbs.csdn.net"; Header ("Location: $url");    Exit;} else{$url = "www.baidu.com"; Header ("Location: $url"); exit;}}}

 
  Untitled Document


The above one is the processing file that PHP writes to the database
One is the form submission file, I want to, for example, the value of the PC submitted as "FF", after the submission, the PHP file successfully written to the database, how to automatically jump "FF" value link
ElseIf ($pc = = "ff") {$url = "www.baidu.com"; Header ("Location: $url"); Exit;}
is how to successfully write to the database, automatically jump to this link


Reply to discussion (solution)

29 Rows: $pc = Intval (R (' pc ', ' P '));
All intval, whether it is the HH FF or DD, the last $pc are 0, so can't jump over
Also jump requires absolute path:/HTTP Start

29 Rows: $pc = Intval (R (' pc ', ' P '));
All intval, whether it is the HH FF or DD, the last $pc are 0, so can't jump over
Also jump requires absolute path:/HTTP Start


This problem, I changed, but also jump not over, successfully written to the database, the page is blank

Defined (' Pcpay_path ') or Exit;class Record_control extends Admin_control {public function Add () {$uid = $this->_user[' UID '];if (Empty ($_post)) {$this->_pkey = ' content '; $this->_ukey = ' record-add '; $this->_title = ' Publish article '; $this- >_place = ' Content» Article management» Publish article '; $habits = (array) $this->kv->get (' user_habits_uid_ '. $uid); $cid = Isset ($habits [' Last_add_cid '])? (int) $habits [' Last_add_cid ']: 0; $data = $this->kv->get (' auto_save_record_uid_ '. $uid); if ($data) {!empty ($data [' CID ']) && $cid = $data [' CID '];} else{$data [' intro '] = Array (); $data [' views '] = 0;} $this->assign (' data ', $data); $cidhtml = $this->category->get_cidhtml_by_mid (2, $cid); $this->assign (' Cidhtml ', $cidhtml); $edit _cid_id = ' &mid=2 '; $this->assign (' edit_cid_id ', $edit _cid_id); $this->display (' Record_set.htm ');} else{$cid = intval (R (' CID ', ' P ')), $products = Intval (R (' products ', ' P ')), $amount = Intval (R (' Amount ', ' P ')); $pc = Intval ( R (' pc ', ' P ')); $data = Array (' cid ' = $cid, ' products ' =&Gt $products, ' amount ' = $amount, ' ip ' = Ip2long ($_env[' _ip '),); $this->cms_content->table = ' Cms_record '; $ id = $this->cms_content->create ($data), if (! $id) {E (1, ' Write table error ');} $this->_user[' contents ']++; $this->user->update ($this->_user); $categorys [' count ']++; $this Category->update ($categorys); $this->category->update_cache ($cid); $data = $this->kv->delete (' Auto_ Save_record_uid_ '. $uid); $habits = (array) $this->kv->get (' user_habits_uid_ '. $uid); $habits [' last_add_cid '] = $ CID; $habits = $this->kv->set (' user_habits_uid_ '. $uid, $habits);//e (0, ' publish complete '. $endstr); if (! $data->e (0,$ ENDSTR)) {exit;} ElseIf ($pc = = "1") {$url = "http://www.w3school.com.cn"; Header ("Location: $url"); Exit;} ElseIf ($pc = = "2") {$url = "www.baidu.com"; Header ("Location: $url"); Exit;} ElseIf ($pc = = "3") {$url = "bbs.csdn.net"; Header ("Location: $url");    Exit;} else{$url = "http://www.baidu.com"; Header ("Location: $url"); exit;}}}
God help See, what's the problem?

29 Rows: $pc = Intval (R (' pc ', ' P '));
All intval, whether it is the HH FF or DD, the last $pc are 0, so can't jump over
Also jump requires absolute path:/HTTP Start


Defined (' Pcpay_path ') or Exit;class Record_control extends Admin_control {public function Add () {$uid = $this        _user[' uid '];            if (empty ($_post)) {$this->_pkey = ' content ';            $this->_ukey = ' record-add ';            $this->_title = ' Publish article ';            $this->_place = ' Content» Article management» Publish articles ';            $habits = (array) $this->kv->get (' user_habits_uid_ '. $uid); $cid = Isset ($habits [' last_add_cid '])?            (int) $habits [' Last_add_cid ']: 0;            $data = $this->kv->get (' auto_save_record_uid_ '. $uid);            if ($data) {!empty ($data [' CID ']) && $cid = $data [' CID '];                }else{$data [' intro '] = Array ();            $data [' views '] = 0;            } $this->assign (' data ', $data);            $cidhtml = $this->category->get_cidhtml_by_mid (2, $cid);            $this->assign (' cidhtml ', $cidhtml);            $edit _cid_id = ' &mid=2 '; $this->assign ('edit_cid_id ', $edit _cid_id);        $this->display (' record_set.htm ');            }else{$cid = intval (R (' cid ', ' P '));            $products = Intval (R (' products ', ' P '));            $amount = Intval (R (' Amount ', ' P '));            $pc = Intval (R (' pc ', ' P ')); $data = Array (' cid ' = $cid, ' products ' + = $products, ' Amount ' = ' $            Amount, ' IP ' = Ip2long ($_env[' _ip '),);            $this->cms_content->table = ' Cms_record ';            $id = $this->cms_content->create ($data);            if (! $id) {E (1, ' Write contents table error ');                } elseif ($pc = = "1") {$url = "http://www.w3school.com.cn";                 Header ("Location: $url");            Exit                } elseif ($pc = = "2") {$url = "www.baidu.com";                 Header ("Location: $url");            Exit } elseif ($pc = = "3") {$url= "Bbs.csdn.net";                 Header ("Location: $url");            Exit                } else{$url = "http://www.baidu.com";                Header ("Location: $url");            Exit }        }    }}
That would be fine, thank you.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.